package com.css.fxfzypg.modules.downloadLegend.service.impl;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.css.fxfzypg.base.attachment.entity.AttachmentInfoEntity;
import com.css.fxfzypg.base.attachment.repository.AttachmentInfoRepository;
import com.css.fxfzypg.base.response.RestResponse;
import com.css.fxfzypg.constants.YNEnum;
import com.css.fxfzypg.modules.SettingSeismic.entity.SettingSeismicDetails;
import com.css.fxfzypg.modules.SettingSeismic.service.SettingSeismicService;
import com.css.fxfzypg.modules.auxiliary.entity.AuxiliaryMap;
import com.css.fxfzypg.modules.auxiliary.repository.AuxiliaryMapRepository;
import com.css.fxfzypg.modules.baseData.entity.HisPrEntity;
import com.css.fxfzypg.modules.baseData.entity.KangZhenTu;
import com.css.fxfzypg.modules.downloadLegend.Vo.LegendVo;
import com.css.fxfzypg.modules.downloadLegend.entity.*;
import com.css.fxfzypg.modules.downloadLegend.service.DownloadsFile;
import com.css.fxfzypg.modules.downloadLegend.Vo.RequestVO;
import com.css.fxfzypg.modules.downloadLegend.Vo.ResponseVO;
import com.css.fxfzypg.modules.downloadLegend.service.SupergraphService;
import com.css.fxfzypg.modules.earthquakedisasterloss.entity.YpgResultSlope;
import com.css.fxfzypg.modules.hypergraph.service.HypergraphService;
import com.css.fxfzypg.modules.preAssessResult.repository.PreAssessResultRepository;
import com.css.fxfzypg.modules.preassesstaskmanage.vo.PreAssessVo;
import com.css.fxfzypg.modules.preassesstaskmanage.vo.PreVo;
import com.css.fxfzypg.modules.resultsManagement.entity.MapManagementEntity;
import com.css.fxfzypg.modules.resultsManagement.entity.MapTemplate;
import com.css.fxfzypg.modules.resultsManagement.repository.MapManagementRepository;
import com.css.fxfzypg.modules.similitudeAnalyse.entity.RealEarthquakeEntity;
import com.css.fxfzypg.modules.surveytaskmanage.repository.FieldSurveyTaskRepository;
import com.css.fxfzypg.modules.surveytaskmanage.vo.FieldSurveyVo;
import com.css.fxfzypg.util.*;
import com.css.fxfzypg.zcpt.sys.entity.SUser;
import com.css.fxfzypg.zcpt.sys.service.SUserService;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j;
import org.slw.common.helper.PropsHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import sun.rmi.runtime.Log;

import javax.annotation.Resource;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.*;
import java.util.logging.Logger;


@Service
@Slf4j
public class SupergraphServiceImpl implements SupergraphService {
    @Resource
    RestTemplateUtil restTemplateUtil;

    @Value("${image.ctLocalDir}")
    private String ctLocalDir;

    @Resource
    private DownloadsFile downloadsFile;
    @Resource
    private PreAssessResultRepository preAssessResultRepository;
    @Resource
    private FieldSurveyTaskRepository fieldSurveyTaskRepository;
    @Resource
    private AttachmentInfoRepository attachmentInfoRepository;
    @Resource
    private SUserService sUserService;
    @Resource
    private MapManagementRepository mapManagementRepository;
//    @Resource
//    RestTemplate restTemplate;
    RestTemplate restTemplate = getRestTemplate();
    @Resource
    JdbcTemplate jdbcTemplate;
    @Resource
    SettingSeismicService settingSeismicService;
    @Autowired
    private AuxiliaryMapRepository auxiliaryMapRepository;
    @Resource
    HypergraphService hypergraphService;

    /**
     * 调度器使用的RestTemplate，超时600s
     * @return
     */
    public RestTemplate getRestTemplate(){
        RestTemplate restTemplate = new RestTemplateBuilder()
                .setConnectTimeout(Duration.ofSeconds(600))
                .setReadTimeout(Duration.ofSeconds(600))
                .build();
        //解决中文乱码
        List<HttpMessageConverter<?>> msgConv = restTemplate.getMessageConverters();
        if(msgConv != null && !msgConv.isEmpty()) {
            for(int i = 0; i < msgConv.size(); i++ ){
                if(msgConv.get(i).getClass().equals(StringHttpMessageConverter.class)) {
                    msgConv.set(i, new StringHttpMessageConverter(StandardCharsets.UTF_8));
                }
            }
        }
        return restTemplate;
    }

    @Override
    public RestResponse supergraph(RequestVO requestVO) {
        RestResponse restResponse = null;
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("supergraphRestTemplateUrl") + "/webprinting/rest/webprinting/v1/jobs.json";
        JSONObject requestJsonVo = (JSONObject) JSONObject.toJSON(requestVO);
        String json = JSONObject.toJSONString(requestJsonVo);
        log.info(json);
        Map map = JSONObject.parseObject(json, Map.class);
        ResponseEntity<String> stringResponseEntity = restTemplateUtil.sendPostHttpRequest(url, map);
        String body = stringResponseEntity.getBody();
        List<ResponseVO> responseVO = JSON.parseArray(body, ResponseVO.class);
        String path = "";
        if (responseVO != null || responseVO.size() > 0) {
            path = responseVO.get(0).getPath();
            //获取出图任务状态
            path = getMapLayerPrintJob(path);
            if(path.equals("出图失败")){
                return RestResponse.fail("出图失败！");
            }
            path = responseVO.get(0).getPath() + "/" + "result";
            String savePath = ctLocalDir;
            path = path.replace("@", "%40");
            System.out.println("路径  " + path);
            restResponse = downloadsFile.downloadByUrl(path, savePath);
        }
        File file = new File(ctLocalDir);
        File[] files = file.listFiles();
        for (File file1 : files) {
            if (file1.isFile()) {
                file1.delete();
            }
        }

        return restResponse;
    }

    //获取出图任务状态
    public String getMapLayerPrintJob(String path) {
        String result = null;
        try {
            String dataUrl = path + ".json";
            try {
                dataUrl = URLDecoder.decode(dataUrl, "utf-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
                return "出图失败";
            }
            dataUrl = dataUrl.replaceAll("%3A", ":").replaceAll("%2F", "/").replaceAll("\\+", "%20");
            //System.out.println(dataUrl);

            HttpHeaders headers = new HttpHeaders();
            headers.set("Content-Type", "application/json; charset=UTF-8");

            HttpEntity<JSONObject> entity = new HttpEntity<>(new JSONObject(), headers);
            ResponseEntity<JSONObject> exchange = restTemplate.exchange(dataUrl, HttpMethod.GET, entity, JSONObject.class);
            JSONObject body = exchange.getBody();
            /*if (body == null) {
                return "出图失败";
            }*/
            if (body.getString("status").equals("ERROR")) {
                return "出图失败";
            }
            while (!body.getString("status").equals("ERROR") && !body.getString("status").equals("FINISHED")) {
                Thread.sleep(1000);
                //获取任务执行百分比
                result = getMapLayerPrintJob(path);
                if(result.equals("出图成功") || result.equals("出图失败")){
                    break;
                }
            }
            if(body.getString("status").equals("FINISHED")){
                return "出图成功";
            }else if (body.getString("status").equals("ERROR")) {
                return "出图失败";
            }
        } catch (Exception e) {
            e.printStackTrace();
            result = getMapLayerPrintJob(path);
        }
        return result;
    }

    //一键打印出图
    @Override
    public RestResponse handle(LegendVo legendVo) {
        //任务id;
        String id = legendVo.getPreVo().getId();
        String reportType = legendVo.getReportType();
        String extent = "";
        String center = "";
        //0 是预评估任务  1是现场调查任务
        if ("0".equals(reportType)) {
            extent = preAssessResultRepository.getExtent(id);
            center = preAssessResultRepository.getcenter(id);
            //预评估任务
            String sql = "select id,task_num,task_name,task_district,sampling_survey_point_id from ypg_preassess_task where id='" + id + "'";
            PreAssessVo preAssessVo = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(PreAssessVo.class));
            legendVo.setPreAssessVo(preAssessVo);
            //查询子任务ID列表
            String sql2 = "select id from ypg_preassess_task where del_flag='0' and parent_id='" + id + "'";
            List<String> taskIdList = jdbcTemplate.queryForList(sql2, String.class);
            legendVo.setTaskIdList(taskIdList);
            //任务信息
            PreVo preVo = new PreVo();
            preVo.setId(preAssessVo.getId());
            preVo.setTaskNum(preAssessVo.getTaskNum());
            preVo.setTaskName(preAssessVo.getTaskName());
            preVo.setTaskDistrict(preAssessVo.getTaskDistrict());
            preVo.setTaskCodeAndTaskName(preAssessVo.getTaskNum() + "-" + preAssessVo.getTaskName());
            legendVo.setPreVo(preVo);
        }
        if ("1".equals(reportType)) {
            extent = fieldSurveyTaskRepository.getExtent(id);
            center = fieldSurveyTaskRepository.getcenter(id);
            //现场调查任务
            String sql = "select id,task_num,task_name,task_district from ypg_survey_task where id='" + id + "'";
            FieldSurveyVo fieldSurveyVo = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(FieldSurveyVo.class));
            legendVo.setFieldSurveyVo(fieldSurveyVo);
            //查询子任务ID列表
            String sql2 = "select id from ypg_survey_task where del_flag='0' and parent_id='" + id + "'";
            List<String> taskIdList = jdbcTemplate.queryForList(sql2, String.class);
            legendVo.setTaskIdList(taskIdList);
            //任务信息
            PreVo preVo = new PreVo();
            preVo.setId(fieldSurveyVo.getId());
            preVo.setTaskNum(fieldSurveyVo.getTaskNum());
            preVo.setTaskName(fieldSurveyVo.getTaskName());
            preVo.setTaskDistrict(fieldSurveyVo.getTaskDistrict());
            preVo.setTaskCodeAndTaskName(fieldSurveyVo.getTaskNum() + "-" + fieldSurveyVo.getTaskName());
            legendVo.setPreVo(preVo);
        }
        String[] split = extent.substring(4, extent.length() - 1).split(",");
        String[] s1 = split[0].split(" ");
        String[] s2 = split[1].split(" ");
        String leftX = s1[0];
        String leftY = s1[1];
        String rightX = s2[0];
        String rightY = s2[1];
        List<MapTemplate> mapTemplates = legendVo.getMapTemplates();
        String formatType = "横版";
        if(mapTemplates.size()>0){
            String format = mapTemplates.get(0).getFormat();//版式  0横板  1竖版  2无
            if(format.equals("0")){//0横板
                formatType = "横版";//测试横版
            }else if(format.equals("1")){//1竖版
                formatType = "竖版";//测试竖版
            }
        }
        //获取Web打印出图模板列表
        List<TemplateEntity> templateEntityList = hypergraphService.getWebprintingLayoutsList();
        legendVo.setTemplateEntityList(templateEntityList);
        //根据经纬度范围获取level值
        int level = getLevel(Double.valueOf(leftX), Double.valueOf(leftY), Double.valueOf(rightX), Double.valueOf(rightY),formatType,null);
        String[] s = center.substring(6, center.length() - 1).split(" ");
        String centerX = s[0];
        String centerY = s[1];
        Map<String, Double> hashMap = new HashMap<>();
        hashMap.put("leftX", Double.valueOf(leftX));
        hashMap.put("leftY", Double.valueOf(leftY));
        hashMap.put("rightX", Double.valueOf(rightX));
        hashMap.put("rightY", Double.valueOf(rightY));
        hashMap.put("centerX", Double.valueOf(centerX));
        hashMap.put("centerY", Double.valueOf(centerY));
        hashMap.put("level", Double.valueOf(level));
        return toData(legendVo, hashMap);
    }

    //震后辅助决策分析结果打印出图
    @Override
    public RestResponse realAnalysePrintImage(String id) {
        try{
            //中国地震台网系统的真实地震信息的ID
            String sql = "select cata_id from ypg_auxiliary_decision where id='"+id+"'";
            String cataId = jdbcTemplate.queryForObject(sql, String.class);
            if (PlatformObjectUtils.isEmpty(cataId)) {
                return RestResponse.fail(503,"全部图件出图失败");
            }
            String sql1 = "select st_extent(geom) from real_seismic_influenceflied where cata_id='" + cataId + "'";
            String extent = jdbcTemplate.queryForObject(sql1, String.class);
            String sql2 = "select ST_AsText(ST_Centroid(ST_extent(geom))) from real_seismic_influenceflied where cata_id='" + cataId + "'";
            String center = jdbcTemplate.queryForObject(sql2, String.class);
            //查询震后辅助决策分析最相似的结果
            String sql3 = "select his_pr_id from ypg_similitude_analyse_result where cata_id=? order by similarity_calculation_result desc limit 1";
            String hisPrId = jdbcTemplate.queryForObject(sql3, String.class, cataId);//历史地震预评估ID
            //查询真实地震信息
            String sql4 = "select * from real_earthquake_info where cata_id=?";
            RealEarthquakeEntity realEarthquakeEntity = jdbcTemplate.queryForObject(sql4, new BeanPropertyRowMapper<>(RealEarthquakeEntity.class), cataId);
            //查询历史地震预评估
            String sql5 = "select * from data_his_pr where id=?";
            HisPrEntity hisPrEntity = jdbcTemplate.queryForObject(sql5, new BeanPropertyRowMapper<>(HisPrEntity.class), hisPrId);
            String dhpTaskNum = hisPrEntity.getDhpTaskNum();//任务编号
            BigDecimal dhpEpicenterLongitude = hisPrEntity.getDhpEpicenterLongitude();//设定经度
            BigDecimal dhpEpicenterLatitude = hisPrEntity.getDhpEpicenterLatitude();//设定纬度
            BigDecimal dhpMagnitude = hisPrEntity.getDhpMagnitude();//设定震级
            //查询角度
            String sql6 = "select fault_angle from real_seismic_influenceflied where cata_id='" + cataId + "' limit 1";
            Float faultAngle = jdbcTemplate.queryForObject(sql6, Float.class);//真实地震影响场角度
            Float tempAngle = null;
            SettingSeismicDetails settingSeismicDetails = null;
            //查询设定地震详情列表
            List<SettingSeismicDetails> seismicDetailsList = settingSeismicService.getByTaskNumAndLonAndLatAndEqLevel(dhpTaskNum, dhpEpicenterLongitude, dhpEpicenterLatitude, dhpMagnitude);
            //查询角度与真实地震影响场角度最接近的设定地震震中ssId
            for(int i=0;i<seismicDetailsList.size();i++){
                SettingSeismicDetails entity = seismicDetailsList.get(i);
                Float angle = Float.valueOf(entity.getAngle());
                if(tempAngle==null){
                    tempAngle = Math.abs(angle - faultAngle);
                    settingSeismicDetails = entity;
                }else{
                    Float tempAbs = Math.abs(angle - faultAngle);
                    if(tempAbs<tempAngle){
                        tempAngle = tempAbs;
                        settingSeismicDetails = entity;
                    }
                }
            }
            String ssId = "";//设定地震震中ssId
            String sourceEarthquakeId = "";//设定地震详情ID
            if(settingSeismicDetails!=null){
                ssId = settingSeismicDetails.getSsId();
                sourceEarthquakeId = settingSeismicDetails.getId();//设定地震详情ID
            }

            LegendVo legendVo = new LegendVo();
            legendVo.setCataId(cataId);
            legendVo.setRealEarthquakeEntity(realEarthquakeEntity);
            legendVo.setSsId(ssId);
            legendVo.setSourceEarthquakeId(sourceEarthquakeId);
            legendVo.setUnit("中国地震灾害防御中心");
            legendVo.setEarthquakeLevel(dhpMagnitude);
            //预评估任务
            String sql7 = "select id,task_num,task_name,task_district from ypg_preassess_task where del_flag='0' and task_num=?";
            PreAssessVo preAssessVo = jdbcTemplate.queryForObject(sql7, new BeanPropertyRowMapper<>(PreAssessVo.class),dhpTaskNum);
            if (PlatformObjectUtils.isNotEmpty(preAssessVo)){
                legendVo.setPreAssessVo(preAssessVo);
            }else {
                legendVo.setPreAssessVo(null);
            }
            //查询影响场范围内房屋抗震能力统计房屋栋数
            int sumAll = 0;
            int sum1 = 0;
            int sum2 = 0;
            int sum3 = 0;
            String sql8 = "select kzt_shockresistance,sum(kzt_shockresistancenumber) as kzt_shockresistancenumber from sys_kangzhentu a," +
                    "(select ST_MakePolygon(ST_ExteriorRing(geom)) as geom from real_seismic_influenceflied where cata_id=? order by dz_intensity limit 1) b " +
                    "where kzt_status='1' and st_intersects(a.geom, b.geom) GROUP BY kzt_shockresistance";
            List<KangZhenTu> kangZhenTuList = jdbcTemplate.query(sql8, new BeanPropertyRowMapper<>(KangZhenTu.class),cataId);
            if(kangZhenTuList!=null && kangZhenTuList.size()>0){
                for(int i=0;i<kangZhenTuList.size();i++){
                    Integer kztShockresistancenumber = kangZhenTuList.get(i).getKztShockresistancenumber(); //当前抗震能力下房屋数量
                    String kztShockresistance = kangZhenTuList.get(i).getKztShockresistance(); // 抗震能力初步估算结果
                    if(kztShockresistancenumber>0){
                        if(kztShockresistance.equals("估计抗震能力达标")){
                            sum1 = kztShockresistancenumber;
                        }else if(kztShockresistance.equals("疑似抗震能力不足")){
                            sum2 = kztShockresistancenumber;
                        }else if(kztShockresistance.equals("疑似抗震能力严重不足")){
                            sum3 = kztShockresistancenumber;
                        }
                    }
                }
                sumAll = sum1 + sum2 + sum3;
            }
            String percent1 = "0.0";
            String percent2 = "0.0";
            String percent3 = "0.0";
            if(sumAll>0){
                DecimalFormat df = new DecimalFormat("#.000");//保留3位小数
                percent1 = df.format(sum1 / sumAll * 100);
                percent2 = df.format(sum2 / sumAll * 100);
                percent3 = df.format(sum3 / sumAll * 100);
            }
            String summaryText = "影响场范围内房屋栋数：\n"+sumAll+"栋\n\n" +
                    "估计抗震能力达标房屋栋数：\n"+sum1+"栋（占比"+percent1+"%）\n\n" +
                    "疑似抗震能力不足房屋栋数：\n"+sum2+"栋（占比"+percent2+"%）\n\n" +
                    "疑似抗震能力严重不足房屋栋数：\n"+sum3+"栋（占比"+percent3+"%）";
            legendVo.setSummaryText(summaryText);
            List<MapTemplate> mapTemplates = new ArrayList<>();
            MapTemplate mapTemplate1 = new MapTemplate();
            mapTemplate1.setMapType("基于遥感影像的XX震中影响场范围内房屋抗震能力初判图");
            mapTemplate1.setDictType("基于遥感影像的XX震中影响场范围内房屋抗震能力初判图");
            mapTemplate1.setDictCode("RealAnalyse_Kangzhen");
            mapTemplate1.setFormat("3");//横版带简介
            mapTemplates.add(mapTemplate1);
            MapTemplate mapTemplate2 = new MapTemplate();
            mapTemplate2.setMapType("建筑物公里格网分布对比图");
            mapTemplate2.setDictType("建筑物公里格网分布对比图");
            mapTemplate2.setDictCode("RealAnalyse_Building");
            mapTemplate2.setFormat("0");//横版
            mapTemplates.add(mapTemplate2);
            MapTemplate mapTemplate3 = new MapTemplate();
            mapTemplate3.setMapType("人口公里格网分布对比图");
            mapTemplate3.setDictType("人口公里格网分布对比图");
            mapTemplate3.setDictCode("RealAnalyse_Population");
            mapTemplate3.setFormat("0");//横版
            mapTemplates.add(mapTemplate3);
            MapTemplate mapTemplate4 = new MapTemplate();
            mapTemplate4.setMapType("经济格网分布对比图");
            mapTemplate4.setDictType("经济格网分布对比图");
            mapTemplate4.setDictCode("RealAnalyse_GDP");
            mapTemplate4.setFormat("0");//横版
            mapTemplates.add(mapTemplate4);
            legendVo.setMapTemplates(mapTemplates);
            //任务信息
            PreVo preVo = new PreVo();
            preVo.setId(preAssessVo.getId());
            preVo.setTaskNum(preAssessVo.getTaskNum());
            preVo.setTaskName(preAssessVo.getTaskName());
            preVo.setTaskDistrict(preAssessVo.getTaskDistrict());
            preVo.setTaskCodeAndTaskName(preAssessVo.getTaskNum() + "-" + preAssessVo.getTaskName());
            legendVo.setPreVo(preVo);

            String[] split = extent.substring(4, extent.length() - 1).split(",");
            String[] s1 = split[0].split(" ");
            String[] s2 = split[1].split(" ");
            String leftX = s1[0];
            String leftY = s1[1];
            String rightX = s2[0];
            String rightY = s2[1];
            String formatType = "横版";//默认横版
            //获取Web打印出图模板列表
            List<TemplateEntity> templateEntityList = hypergraphService.getWebprintingLayoutsList();
            legendVo.setTemplateEntityList(templateEntityList);
            //根据经纬度范围获取level值
            int level = getLevel(Double.valueOf(leftX), Double.valueOf(leftY), Double.valueOf(rightX), Double.valueOf(rightY),formatType,null);
            String[] s = center.substring(6, center.length() - 1).split(" ");
            String centerX = s[0];
            String centerY = s[1];
            Map<String, Double> hashMap = new HashMap<>();
            hashMap.put("leftX", Double.valueOf(leftX));
            hashMap.put("leftY", Double.valueOf(leftY));
            hashMap.put("rightX", Double.valueOf(rightX));
            hashMap.put("rightY", Double.valueOf(rightY));
            hashMap.put("centerX", Double.valueOf(centerX));
            hashMap.put("centerY", Double.valueOf(centerY));
            hashMap.put("level", Double.valueOf(level));

            String returnMsg = "";
            int successCount = 0;
            for (MapTemplate mapTemplate : mapTemplates) {
                String result = toDataMapTemplate(legendVo,hashMap,mapTemplate);
                if(!result.equals("出图成功")){
                    if (PlatformObjectUtils.isNotEmpty(returnMsg)) {
                        returnMsg += "、";
                    }
                    returnMsg += result;
                }else{
                    successCount++;
                }
            }
            if (PlatformObjectUtils.isNotEmpty(returnMsg)) {
                returnMsg += "出图失败！";
                if(successCount>0){
                    returnMsg += "其余图件出图成功";
                }else{
                    returnMsg = "全部图件出图失败";
                }
                System.out.println(returnMsg);
                return RestResponse.fail(503,returnMsg);
            }else{
                returnMsg = "出图成功！";
                return RestResponse.succeed(returnMsg);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return RestResponse.fail(503,"由于报错出图失败");
        }
    }

    //根据超图模板名、模板信息列表获取模板信息
    public TemplateEntity getTemplateEntityByTemplateName(String smTemplateName,List<TemplateEntity> templateEntityList){
        TemplateEntity templateEntity = null;
        if (PlatformObjectUtils.isNotEmpty(smTemplateName) && templateEntityList.size()>0){
            for(TemplateEntity entity : templateEntityList){
                if(smTemplateName.equals(entity.getTemplateName())){
                    templateEntity = entity;
                    break;
                }
            }
        }

        return templateEntity;
    }

    //获取经纬网参数
    public MapGridOptions getMapGridOptions(double leftBottom_X,double leftBottom_Y,double rightTop_X,double rightTop_Y,String format) {
        double minLon = leftBottom_X;
        double minLat = leftBottom_Y;
        double maxLon = rightTop_X;
        double maxLat = rightTop_Y;
        //获取经度差值
        double diffLon = maxLon - minLon;
        //横版4*3个格网
        double xNum = 4;
        double yNum = 3;
        //竖版3*4个格网
        if(format.equals("1")){//竖版
            xNum = 3;
            yNum = 4;
        }
        double tempLon = diffLon / xNum;
        if(tempLon>1){
            tempLon = Math.round(tempLon);
        }else if(tempLon>0.5){
            tempLon = 0.5;//30分
        }else if(tempLon>0.25){
            tempLon = 0.25;//15分
        }else if(tempLon>0.125){
            tempLon = 0.125;//7分30秒
        }else if(tempLon>0.0625){
            tempLon = 0.0625;//3分45秒
        }else if(tempLon>0.05){
            tempLon = 0.05;//3分
        }else if(tempLon>0.025){
            tempLon = 0.025;//1分30秒
        }else if(tempLon>0.0125){
            tempLon = 0.0125;//45秒
        }else{
            tempLon = 0.0025;//9秒
        }
        //再次校正
        if(tempLon<1){
            double num = Math.floor(diffLon/tempLon);
            if(num>(xNum*2)){
                tempLon = tempLon * 2;
            }
        }
        //获取纬度差值
        double diffLat = maxLat - minLat;
        double tempLat = diffLat / yNum;
        if(tempLat>1){
            tempLat = Math.round(tempLat);
        }else if(tempLat>0.5){
            tempLat = 0.5;//30分
        }else if(tempLat>0.25){
            tempLat = 0.25;//15分
        }else if(tempLat>0.125){
            tempLat = 0.125;//7分30秒
        }else if(tempLat>0.0625){
            tempLat = 0.0625;//3分45秒
        }else if(tempLat>0.05){
            tempLat = 0.05;//3分
        }else if(tempLat>0.025){
            tempLat = 0.025;//1分30秒
        }else if(tempLat>0.0125){
            tempLat = 0.0125;//45秒
        }else{
            tempLat = 0.0025;//9秒
        }
        //再次校正
        if(tempLat<1){
            double num = Math.floor(diffLat/tempLat);
            if(num>(yNum*2)){
                tempLat = tempLat * 2;
            }
        }
        MapGridOptions mapGridOptions = new MapGridOptions();//经纬度网格边框
        mapGridOptions.setOriginX(-180);
        mapGridOptions.setOriginY(-90);
        mapGridOptions.setCellWidth(tempLon);
        mapGridOptions.setCellHeight(tempLat);
        mapGridOptions.setMarkType("DMS");

        return mapGridOptions;
    }

    //根据level获取经纬网参数
    public MapGridOptions getMapGridOptionsByLevel(double level,String format) {
        int[] levelArr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
        double[] cellDiffArr = {160, 80, 40, 20, 10, 5, 2.5, 1.25, 0.5, 0.25, 0.125, 0.0625, 0.05, 0.025, 0.0125, 0.005, 0.0025, 0.0011};
        double cellDiff = 1;
        for(int i=0;i<levelArr.length;i++){
            if(levelArr[i]==level){
                cellDiff = cellDiffArr[i];
                break;
            }
        }
//        //横版4*3个格网
//        double xNum = 4;
//        double yNum = 3;
//        //竖版3*4个格网
//        if(format.equals("1")){//竖版
//            xNum = 3;
//            yNum = 4;
//        }
//        double tempLon = cellDiff * xNum / 4;
//        double tempLat = tempLon * yNum / xNum;
//        for(int i=1;i<cellDiffArr.length;i++){
//            if(tempLon<cellDiffArr[i-1] && tempLon>=cellDiffArr[i]){
//                tempLon = cellDiffArr[i];
//            }
//            if(tempLat<cellDiffArr[i-1] && tempLat>=cellDiffArr[i]){
//                tempLat = cellDiffArr[i];
//            }
//        }
        MapGridOptions mapGridOptions = new MapGridOptions();//经纬度网格边框
        mapGridOptions.setOriginX(-180);
        mapGridOptions.setOriginY(-90);
//        mapGridOptions.setCellWidth(tempLon);
//        mapGridOptions.setCellHeight(tempLat);
        mapGridOptions.setCellWidth(cellDiff);
        mapGridOptions.setCellHeight(cellDiff);
        mapGridOptions.setMarkType("DMS");

        return mapGridOptions;
    }

    //根据经纬度范围获取level值
    public int getLevel(double leftBottom_X,double leftBottom_Y,double rightTop_X,double rightTop_Y,String formatType,TemplateEntity templateEntity) {
        int level = 4;//默认级别4
        double minLon = leftBottom_X;
        double minLat = leftBottom_Y;
        double maxLon = rightTop_X;
        double maxLat = rightTop_Y;
        //获取最大差值
        double diffLon = maxLon - minLon;
        double diffLat = maxLat - minLat;
        double diffMax = diffLon;
        if(diffLon < diffLat){
            diffMax = diffLat;
        }
//        int diff = Math.round(diffMax);
//        long round = Math.round(diffMax);
        //1-18缩放级别zoom
        /*int[] levelArr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
        Double[] diffArr = {360.0,180.0,90.0,45.0,22.0,11.0,5.0,2.5,1.25, 0.6,0.3,0.15,0.07,0.03,0.015,0.007,0.0003,0.00015};
        for (int i = 0; i < diffArr.length; i++) {
            if (diffMax - diffArr[i] >= 0) {
                level = levelArr[i];
                break;
            }
        }*/
        int width = 1510;
        int height = 1020;
        if(formatType.equals("横版") || formatType.equals("0")){
            width = 1510;
            height = 1020;
        }else if(formatType.equals("竖版") || formatType.equals("1")){//竖版
            width = 1150;
            height = 1230;
        }else if(formatType.equals("横版带简介") || formatType.equals("3")){//横版带简介
            width = 1160;
            height = 1010;
        }
        //根据超图模板信息
        if(templateEntity!=null){
            width = templateEntity.getWebMapFrameSizeX();//图件宽度
            height = templateEntity.getWebMapFrameSizeY();//图件高度
        }
        //根据区域范围计算zoom级别，width、height是以像素为单位的地图布局大小
        level = getBoundsZoomLevel(leftBottom_X,leftBottom_Y,rightTop_X,rightTop_Y,width, height);
        //至少为4级，防止地图经纬度格网不显示
        if(level<4){
            level = 4;
        }

        return level;
    }

    final static int GLOBE_WIDTH = 256;
    final static int ZOOM_MAX = 18;
    //根据区域范围计算zoom级别，width、height是以像素为单位的地图布局大小
    public static int getBoundsZoomLevel(double leftBottom_X,double leftBottom_Y,double rightTop_X,double rightTop_Y,
                                         int width, int height) {
        double latFraction = (latRad(rightTop_Y) - latRad(leftBottom_Y)) / Math.PI;
        double lngDiff = rightTop_X - leftBottom_X;
        double lngFraction = ((lngDiff < 0) ? (lngDiff + 360) : lngDiff) / 360;
        double latZoom = zoom(height, GLOBE_WIDTH, latFraction);
        double lngZoom = zoom(width, GLOBE_WIDTH, lngFraction);
        double zoom = Math.min(Math.min(latZoom, lngZoom),ZOOM_MAX);
        return (int)(zoom);
    }
    private static double latRad(double lat) {
        double sin = Math.sin(lat * Math.PI / 180);
        double radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
        return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2;
    }
    private static double zoom(double mapPx, double worldPx, double fraction) {
        final double LN2 = .693147180559945309417;
        return (Math.log(mapPx / worldPx / fraction) / LN2);
    }

    private RestResponse toData(LegendVo legendVo, Map<String, Double> hashMap) {
        List<MapTemplate> mapTemplates = legendVo.getMapTemplates();
        String returnMsg = "";
        int successCount = 0;
        for (MapTemplate mapTemplate : mapTemplates) {
            String result = toDataMapTemplate(legendVo,hashMap,mapTemplate);
            if(!result.equals("出图成功")){
                if (PlatformObjectUtils.isNotEmpty(returnMsg)) {
                    returnMsg += "、";
                }
                returnMsg += result;
            }else{
                successCount++;
            }
        }
        if (PlatformObjectUtils.isNotEmpty(returnMsg)) {
            returnMsg += "出图失败！";
            if(successCount>0){
                returnMsg += "其余选择的图件出图成功";
            }else{
                returnMsg = "全部图件出图失败";
            }
            return RestResponse.fail(503,returnMsg);
        }else{
            returnMsg = "出图成功！";
            return RestResponse.succeed(returnMsg);
        }
    }

    private String toDataMapTemplate(LegendVo legendVo, Map<String, Double> hashMap,MapTemplate mapTemplate) {
        String result = "出图成功";
        String mapType = mapTemplate.getMapType();
        try{
            String dictCode = mapTemplate.getDictCode();
            if ("Seismic_Capacity_Grid".equals(dictCode)||"Seismic_Capacity_Town".equals(dictCode)||"Seismic_Capacity_County".equals(dictCode)) {
                //建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
                String dataSource = "0";//0:区县级,1:乡镇级,2:公里格网级
                if ("Seismic_Capacity_Grid".equals(dictCode)) {
                    dataSource = "2";
                } else if ("Seismic_Capacity_Town".equals(dictCode)) {
                    dataSource = "1";
                } else if ("Seismic_Capacity_County".equals(dictCode)) {
                    dataSource = "0";
                }
                String attachIds = "";//多个图件id用,分隔
                String titles = "";//多个图件标题用,分隔
                String sql = "select dz_intensity from seismic_capacity_distribution where data_source='" + dataSource + "' GROUP BY dz_intensity order by cast(dz_intensity as int)";
                List<String> list = jdbcTemplate.queryForList(sql, String.class);
                if (list.size()==0) {
                    result = mapType;
                    log.error(mapType+"出图失败!","无图层数据");
                    return result;
                }
                for (int i = 0; i < list.size(); i++) {
                    legendVo.setDzIntensity(list.get(i));//烈度
                    RequestVO requestVO = getRequestVO(legendVo,mapTemplate,hashMap);
                    RestResponse response = supergraph(requestVO);
                    if (response.getCode() != 200) {
                        return mapType;
                    }
                    String attachId= response.getData().toString();
                    if (PlatformObjectUtils.isNotEmpty(attachIds)) {
                        attachIds += ",";
                    }
                    attachIds += attachId;
                    //获取图件标题
                    String title = getTitleByDictCodeTask(legendVo,mapTemplate);
                    if (PlatformObjectUtils.isNotEmpty(titles)) {
                        titles += ",";
                    }
                    titles += title;
                }
                //获取图件实体
                MapManagementEntity entity = getEntity(attachIds, legendVo, mapTemplate);
                //一键出图
                MapManagementEntity byLabel = mapManagementRepository.getByLabel(entity.getTaskId(), entity.getMapLabel());
                if (byLabel == null) {
                    entity.setTitle(titles);
                    mapManagementRepository.saveMap(entity);
                } else {
                    byLabel.setMapDescription(entity.getMapDescription());
                    byLabel.setMapClassify(entity.getMapClassify());
                    byLabel.setMapName(entity.getMapName());
                    byLabel.setMapLabel(entity.getMapLabel());
                    byLabel.setAttachId(entity.getAttachId());
                    byLabel.setUpdateUser(PlatformSessionUtils.getUserId());
                    byLabel.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
                    byLabel.setTitle(titles);
                    mapManagementRepository.update(byLabel);
                }
            }else if ("Geologic_Hazard_Risk".equals(dictCode)||"Traffic_Damage".equals(dictCode)) {
                //遭遇烈度XX度地震地质灾害风险分布图、交通遭遇烈度XX度时交通受损情况分布图按不同烈度保存多张图
                String attachIds = "";//多个图件id用,分隔
                String titles = "";//多个图件标题用,分隔
                String taskId = legendVo.getPreVo().getId();//任务ID
                //查询有计算结果的烈度列表
                String sql = "select dz_intensity from ypg_result_slope_new where task_id = '"+taskId+"' GROUP BY dz_intensity order by cast(dz_intensity as int)";
                List<String> list = jdbcTemplate.queryForList(sql, String.class);
                if (list.size()==0) {
                    result = mapType;
                    log.error(mapType+"出图失败!","无图层数据");
                    return result;
                }
                for (int i = 0; i < list.size(); i++) {
                    legendVo.setDzIntensity(list.get(i));//烈度6-11
                    RequestVO requestVO = getRequestVO(legendVo,mapTemplate,hashMap);
                    RestResponse response = supergraph(requestVO);
                    if (response.getCode() != 200) {
                        return mapType;
                    }
                    String attachId= response.getData().toString();
                    if (PlatformObjectUtils.isNotEmpty(attachIds)) {
                        attachIds += ",";
                    }
                    attachIds += attachId;
                    //获取图件标题
                    String title = getTitleByDictCodeTask(legendVo,mapTemplate);
                    if (PlatformObjectUtils.isNotEmpty(titles)) {
                        titles += ",";
                    }
                    titles += title;
                }
                //获取图件实体
                MapManagementEntity entity = getEntity(attachIds, legendVo, mapTemplate);
                //一键出图
                MapManagementEntity byLabel = mapManagementRepository.getByLabel(entity.getTaskId(), entity.getMapLabel());
                if (byLabel == null) {
                    entity.setTitle(titles);
                    mapManagementRepository.saveMap(entity);
                } else {
                    byLabel.setMapDescription(entity.getMapDescription());
                    byLabel.setMapClassify(entity.getMapClassify());
                    byLabel.setMapName(entity.getMapName());
                    byLabel.setMapLabel(entity.getMapLabel());
                    byLabel.setAttachId(entity.getAttachId());
                    byLabel.setUpdateUser(PlatformSessionUtils.getUserId());
                    byLabel.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
                    byLabel.setTitle(titles);
                    mapManagementRepository.update(byLabel);
                }
            }else{//打印1张图
                RequestVO requestVO = getRequestVO(legendVo,mapTemplate,hashMap);
                RestResponse response = supergraph(requestVO);
                if (response.getCode() != 200) {
                    return mapType;
                }
                String attachId= response.getData().toString();
                String cataId = legendVo.getCataId();
                if (PlatformObjectUtils.isNotEmpty(cataId)) {//中国地震台网系统的真实地震信息的ID
                    String dictType = mapTemplate.getDictType();
                    String type = "0";
                    //震后辅助决策分析结果打印出图
                    if ("RealAnalyse_Kangzhen".equals(dictCode)) type = "0";
                    if ("RealAnalyse_Building".equals(dictCode)) type = "1";
                    if ("RealAnalyse_Population".equals(dictCode)) type = "2";
                    if ("RealAnalyse_GDP".equals(dictCode)) type = "3";
                    //震后辅助决策分析结果打印出图
                    AuxiliaryMap auxiliaryMap = auxiliaryMapRepository.getByCataId(cataId,type);
                    if (auxiliaryMap == null) {
                        auxiliaryMap = new AuxiliaryMap();
                        auxiliaryMap.setName(dictType);//图件名称
                        auxiliaryMap.setType(type); //图件类型
                        //真实地震信息
                        RealEarthquakeEntity realEarthquakeEntity = legendVo.getRealEarthquakeEntity();
                        if(realEarthquakeEntity!=null){
                            String oTime = realEarthquakeEntity.getOTime();
                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                            Date seismogenicTime = sdf.parse(oTime);
                            auxiliaryMap.setSeismogenicTime(seismogenicTime);//发震时间
                            auxiliaryMap.setMagnitude(realEarthquakeEntity.getM());//震级
                            auxiliaryMap.setLongitude(Double.valueOf(realEarthquakeEntity.getEpiLon()));//震中经度
                            auxiliaryMap.setLatitude(Double.valueOf(realEarthquakeEntity.getEpiLat()));//震中纬度
                        }
                        auxiliaryMap.setMapId(attachId);//图件id
                        auxiliaryMap.setCataId(legendVo.getCataId());//中国地震台网系统的真实地震信息的ID
                        auxiliaryMap.setId(UUIDGenerator.getUUID());
                        auxiliaryMap.setDelFlag(YNEnum.N.toString());
                        String userId = PlatformSessionUtils.getUserId();
                        String userJson = sUserService.getSUser(userId);
                        SUser sUser = CreateGson.createGson().fromJson(userJson, SUser.class);
                        auxiliaryMap.setCreateUser(userId);
                        auxiliaryMap.setUploadUser(sUser.getUserName());
                        auxiliaryMap.setUploadTime(PlatformDateUtils.getCurrentTimestamp());
                        auxiliaryMapRepository.save(auxiliaryMap);
                    } else {
                        auxiliaryMap.setName(dictType);//图件名称
                        auxiliaryMap.setType(type); //图件类型
                        auxiliaryMap.setMapId(attachId);//图件id
                        auxiliaryMap.setUpdateUser(PlatformSessionUtils.getUserId());
                        auxiliaryMap.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
                        auxiliaryMapRepository.update(auxiliaryMap);
                    }
                }else{
                    //获取图件实体
                    MapManagementEntity entity = getEntity(response.getData().toString(), legendVo, mapTemplate);
                    //一键出图
                    MapManagementEntity byLabel = mapManagementRepository.getByLabel(entity.getTaskId(), entity.getMapLabel());
                    if (byLabel == null) {
                        mapManagementRepository.saveMap(entity);
                    } else {
                        byLabel.setMapDescription(entity.getMapDescription());
                        byLabel.setMapClassify(entity.getMapClassify());
                        byLabel.setMapName(entity.getMapName());
                        byLabel.setMapLabel(entity.getMapLabel());
                        byLabel.setAttachId(entity.getAttachId());
                        byLabel.setUpdateUser(PlatformSessionUtils.getUserId());
                        byLabel.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
                        mapManagementRepository.update(byLabel);
                    }
                }
            }
        }catch (Exception e){
            result = mapType;
            log.error(mapType+"出图失败!",e);
        }

        return result;
    }

    //设置打印出图请求体
    private RequestVO getRequestVO(LegendVo legendVo,MapTemplate mapTemplate, Map<String, Double> hashMap) {
        //获取模板文件名
        String templateName = null;
        //获取Web打印出图模板列表
        List<TemplateEntity> templateEntityList = legendVo.getTemplateEntityList();
        //根据超图模板名、模板信息列表获取模板信息
        TemplateEntity templateEntity = getTemplateEntityByTemplateName(mapTemplate.getSmTemplateName(),templateEntityList);
        if(templateEntity!=null){
            templateName = templateEntity.getTemplateName();
        }
        RequestVO requestVO = new RequestVO();
        LayoutOptions layoutOptions = new LayoutOptions();
        String format = mapTemplate.getFormat();//版式  0横板  1竖版  2无 3横版带简介
        if (PlatformObjectUtils.isEmpty(templateName)) {//如果没有模板名，则使用默认模板
            // 有备注参数summaryText
            templateName = "Administrative_Active_Fault-hf1012";
            if(format.equals("0")){//0横板
                templateName = "Administrative_Active_Fault-hf1012";//测试横版
            }else if(format.equals("1")){//1竖版
                templateName = "Administrative_Active_Fault-v1012";//测试竖版
            }else if(format.equals("2")){//2无
                templateName = "Administrative_Active_Fault-hf1012";//测试横版
            }else if(format.equals("3")){//3横版带简介
                templateName = "Administrative_Active_Fault-h1012";//测试横版带简介
            }
        }
        layoutOptions.setTemplateName(templateName);//模板名
//        layoutOptions.setTitle(mapTemplate.getDictType());
        String title = getTitleByDictCodeTask(legendVo,mapTemplate);
        //用URLEncode编码，防止如%符号不能打印
        title = setStringEncoder(title);
        layoutOptions.setTitle(title);//标题
        //用URLEncode编码，防止如%符号不能打印
        String unit = setStringEncoder(legendVo.getUnit());
        layoutOptions.setAuthor("制图单位："+unit);//制图单位
        String date = DateUtil.format(new Date(), "yyyy年MM月dd日");
        layoutOptions.setTime("制图时间:"+date);//制图时间
        if("RealAnalyse_Kangzhen".equals(mapTemplate.getDictCode())){//基于遥感影像的XX震中影响场范围内房屋抗震能力初判图
            //用URLEncode编码，防止如%符号不能打印
            String summaryText = setStringEncoder(legendVo.getSummaryText());
            layoutOptions.setSummaryText(summaryText);
        }
        ScaleBarOptions scaleBarOptions = new ScaleBarOptions("","BAR",5,"METER");
        layoutOptions.setScaleBarOptions(scaleBarOptions);
//        NorthArrowOptions northArrowOptions = new NorthArrowOptions("file://NorthArrow.svg");
        NorthArrowOptions northArrowOptions = new NorthArrowOptions("file://ARROW_RIGHT_FILL_WITH_COLOR.svg");
        layoutOptions.setNorthArrowOptions(northArrowOptions);
        if(templateEntity!=null){//读取模板信息宽高、经纬度范围获取level值
            int level = getLevel(hashMap.get("leftX"), hashMap.get("leftY"), hashMap.get("rightX"), hashMap.get("rightY"),format,templateEntity);
            hashMap.put("level", Double.valueOf(level));
        }
        //获取经纬网参数
        MapGridOptions mapGridOptions = getMapGridOptionsByLevel(hashMap.get("level"),format);
        layoutOptions.setMapGridOptions(mapGridOptions);
        LegendOption legendOption = new LegendOption();
        legendOption.setTitle("图 例");
        String dictCode = mapTemplate.getDictCode();//出图类型字典code
        //根据dictCode、任务ID获取临时图层URL的Map
        Map<String,String> tempLayerUrlMap = getTempLayerUrlMapByDictCode(dictCode,legendVo);
        List<Layerr> layerrs = getLayerrs(dictCode,legendVo,tempLayerUrlMap);
        legendOption.setLayers(layerrs);
        layoutOptions.setLegendOptions(legendOption);
        requestVO.setLayoutOptions(layoutOptions);
        ExportOptions exportOptions = new ExportOptions("png", 120.0);
        requestVO.setExportOptions(exportOptions);
        Content content = new Content();
        content.setType("WEBMAP");
        com.css.fxfzypg.modules.downloadLegend.entity.Value value = new com.css.fxfzypg.modules.downloadLegend.entity.Value();
        leftAndright leftBottom = new leftAndright(hashMap.get("leftX"), hashMap.get("leftY"));
        leftAndright rightTop = new leftAndright(hashMap.get("rightX"), hashMap.get("rightY"));
        Extent extent = new Extent(leftBottom, rightTop);
        value.setExtent(extent);
        value.setMaxScale("1:2130.3378410848");
        value.setLevel(hashMap.get("level"));
//        value.setLevel(11.0);
        leftAndright center = new leftAndright(hashMap.get("centerX"), hashMap.get("centerY"));
        value.setCenter(center);
//        BaseLayer baseLayer = new BaseLayer("TILE", "China", "http://10.13.155.192:8090/iserver/services/map-fxfzypg/rest/maps/data_faultage@fxfzypg");
//        value.setBaseLayer(baseLayer);
        List<Layer> layers = getLayers(dictCode,legendVo,tempLayerUrlMap);
        value.setLayers(layers);
        value.setDescription("");
        value.setProjection("EPSG:4490");
        value.setMinScale("1:591658710.909131");
        value.setTitle("China");
        value.setVersion("2.3.0");
        content.setValue(value);
        requestVO.setContent(content);
        return requestVO;
    }

    //用URLEncode编码，防止如%符号不能打印
    public String setStringEncoder(String string) {
        String stringEncoder = string;
        try{
            stringEncoder = URLEncoder.encode(string,"UTF-8");
        }catch (Exception e){
            e.printStackTrace();
        }

        return stringEncoder;
    }

    private List<Layer> getLayers(String dictCode,LegendVo legendVo,Map<String,String> tempLayerUrlMap) {
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("supergraphRestTemplateUrl");
        List<Layer> layers =null;
        //人口公里格网分布图
        if ("Population_Grid".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_pbe_population@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_pbe_population",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //经济公里格网分布图
        if ("GDP_Grid".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_pbe_gdp@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_pbe_gdp",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //行政区划分布图
        if ("Administrative_Active_Fault".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-datacenter/rest/maps/jc_resp_town@datacenter";
            String url9 = url + "/map-datacenter/rest/maps/jc_resp_village@datacenter";
            String url10 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"jc_resp_town",url8);
            Layer layer9 = new Layer("TILE",true,"jc_resp_village",url9);
            Layer layer10 = new Layer("TILE",true,"data_faultage",url10);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10);
//            layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10);
            layers = Arrays.asList(layer10,layer9,layer8,layer1);
        }
        String dzIntensity = legendVo.getDzIntensity();//烈度6-10：建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
        //建筑物综合抗震能力评价图(格网)
        if ("Seismic_Capacity_Grid".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_2@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_2",url7);
            //获取临时图层
            url7 = tempLayerUrlMap.get("seismic_capacity_distribution_2_"+dzIntensity);
            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_2",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //建筑物综合抗震能力评价图(乡镇)
        if ("Seismic_Capacity_Town".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_1@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_1",url7);
            //获取临时图层
            url7 = tempLayerUrlMap.get("seismic_capacity_distribution_1_"+dzIntensity);
            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_1",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //建筑物综合抗震能力评价图(区县)
        if ("Seismic_Capacity_County".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_0@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_0",url7);
            //获取临时图层
            url7 = tempLayerUrlMap.get("seismic_capacity_distribution_0_"+dzIntensity);
            Layer layer7 = new Layer("TILE",true,"seismic_capacity_distribution_0",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //学校分布图
        if ("School_Map".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_school@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_school",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //地震灾害隐患点分布图
        if ("Geologic_Hazard_Points".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_geological_disasters@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_geological_disasters",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //历史地震分布图
        if ("Historical_Earthquake".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-datacenter/rest/maps/jc_strong_catalog@datacenter";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"jc_strong_catalog",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7);
//            layers = Arrays.asList(layer1,layer7);
            layers = Arrays.asList(layer7,layer1);
        }
        //地震地质构造图
        if ("Historical_Earthquake_Active_Fault".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-datacenter/rest/maps/jc_strong_catalog@datacenter";
            String url8 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"jc_strong_catalog",url7);
            Layer layer8 = new Layer("TILE",true,"data_faultage",url8);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8);
//            layers = Arrays.asList(layer1,layer7,layer8);
            layers = Arrays.asList(layer7,layer8,layer1);
        }
        //交通分布图
        if ("Traffic_Map".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-datacenter/rest/maps/jc_lrrl@datacenter";
            String url8 = url + "/map-fxfzypg/rest/maps/sys_road_gaosu@fxfzypg";
            String url9 = url + "/map-fxfzypg/rest/maps/sys_road_guodao@fxfzypg";
            String url10 = url + "/map-fxfzypg/rest/maps/sys_road_shengdao@fxfzypg";
            String url11 = url + "/map-fxfzypg/rest/maps/sys_road_xiandao@fxfzypg";
            String url12 = url + "/map-fxfzypg/rest/maps/sys_road_qiaoliang@fxfzypg";
            String url13 = url + "/map-fxfzypg/rest/maps/sys_airport@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"jc_lrrl",url7);
            Layer layer8 = new Layer("TILE",true,"sys_road_gaosu",url8);
            Layer layer9 = new Layer("TILE",true,"sys_road_guodao",url9);
            Layer layer10 = new Layer("TILE",true,"sys_road_shengdao",url10);
            Layer layer11 = new Layer("TILE",true,"sys_road_xiandao",url11);
            Layer layer12 = new Layer("TILE",true,"sys_road_qiaoliang",url12);
            Layer layer13 = new Layer("TILE",true,"sys_airport",url13);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10,layer11,layer12,layer13);
//            layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10,layer11,layer12,layer13);
            layers = Arrays.asList(layer13,layer12,layer11,layer10,layer9,layer8,layer7,layer1);
        }
        //设置地震点分布图
        if ("Scenario_Earthquake".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-datacenter/rest/maps/jc_resp_town@datacenter";
            String url9 = url + "/map-datacenter/rest/maps/jc_resp_village@datacenter";
            String url10 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            String url11 = url + "/map-fxfzypg/rest/maps/setting_seismic_point@fxfzypg";
            String url12 = url + "/map-fxfzypg/rest/maps/ypg_preassess_task@fxfzypg";
            //获取临时图层
            url11 = tempLayerUrlMap.get("setting_seismic_point");
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"jc_resp_town",url8);
            Layer layer9 = new Layer("TILE",true,"jc_resp_village",url9);
            Layer layer10 = new Layer("TILE",true,"data_faultage",url10);
            Layer layer11 = new Layer("TILE",true,"setting_seismic_point",url11);
//            Layer layer12 = new Layer("TILE",true,"ypg_preassess_task",url12);
            //获取临时图层
            url12 = tempLayerUrlMap.get("ypg_preassess_task");
            Layer layer12 = new Layer("TILE",true,"ypg_preassess_task",url12);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10,layer11);
//            layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10,layer11);
//            layers = Arrays.asList(layer11,layer10,layer9,layer8,layer7,layer1);
//            layers = Arrays.asList(layer12,layer11,layer10,layer9,layer8,layer7,layer1);
            layers = Arrays.asList(layer9,layer8,layer1,layer10,layer12,layer11);
        }
        //危化企业,加油站分布图
        if ("Hazardous_Chemicals_Gas".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/sys_riskenterprisedata@fxfzypg";
            String url9 = url + "/map-fxfzypg/rest/maps/sys_gasstationdata@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"sys_riskenterprisedata",url8);
            Layer layer9 = new Layer("TILE",true,"sys_gasstationdata",url9);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9);
//            layers = Arrays.asList(layer1,layer7,layer8,layer9);
            layers = Arrays.asList(layer9,layer8,layer1);
        }
        //次生危险源分布图
        if ("Chemicals_Gas_Tailings_Pond".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/sys_riskenterprisedata@fxfzypg";
            String url9 = url + "/map-fxfzypg/rest/maps/sys_gasstationdata@fxfzypg";
            String url10 = url + "/map-datacenter/rest/maps/jc_tailings_pond@datacenter";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"sys_riskenterprisedata",url8);
            Layer layer9 = new Layer("TILE",true,"sys_gasstationdata",url9);
            Layer layer10 = new Layer("TILE",true,"jc_tailings_pond",url10);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10);
//            layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10);
            layers = Arrays.asList(layer10,layer9,layer8,layer1);
        }
        //水库分布图
        if ("Reservoir_Map".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/data_reservoir@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"data_reservoir",url8);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8);
//            layers = Arrays.asList(layer1,layer7,layer8);
            layers = Arrays.asList(layer8,layer1);
        }
        //地形图 少一个图例DEM
        if ("Topography_DEM".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/ugcv5-DEM/rest/maps/DEM";
//            String url8 = url + "/map-fxfzypg/rest/maps/sys_elevation_new@fxfzypg";
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"DEM",url7);
//            Layer layer8 = new Layer("TILE",true,"sys_elevation_new",url8);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer8,layer7);
//            layers = Arrays.asList(layer1,layer7,layer8);
            String taskDistrict = legendVo.getPreVo().getTaskDistrict();
            //获取DEM图层名称列表
            List<String> DEMnameList = getDEMlayerNameList(taskDistrict);
            layers = new ArrayList<>();
            for(int i=0;i<DEMnameList.size();i++){
                String DEMname = DEMnameList.get(i);
                String DEMurl = url + "/map-demtif/rest/maps/" + DEMname;
                Layer DEMlayer = new Layer("TILE",true,DEMname,DEMurl);
                layers.add(DEMlayer);
            }
            layers.add(layer1);
        }
        //调研点分布图(Research_Points)
        if ("Research_Points".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
//            String url8 = url + "/map-fxfzypg/rest/maps/ypg_sampling_survey_new@fxfzypg";
            //获取临时图层
            String url8 = tempLayerUrlMap.get("ypg_sampling_survey_new");
            if (PlatformObjectUtils.isNotEmpty(url8)) {
                Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//                Layer layer7 = new Layer("TILE",true,"data_area",url7);
                Layer layer8 = new Layer("TILE",true,"ypg_sampling_survey_new",url8);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8);
//                layers = Arrays.asList(layer1,layer7,layer8);
                layers = Arrays.asList(layer8,layer1);
            }else{
                Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//                Layer layer7 = new Layer("TILE",true,"data_area",url7);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8);
//                layers = Arrays.asList(layer1,layer7);
                layers = Arrays.asList(layer1);
            }
        }
        //遭遇烈度XX度地震地质灾害风险分布图(Geologic_Hazard_Risk)
        if ("Geologic_Hazard_Risk".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/ypg_result_road_new@fxfzypg";
//            String url8 = url + "/map-fxfzypg/rest/maps/ypg_result_slope@fxfzypg";
            //获取临时图层
//            String url7 = tempLayerUrlMap.get("ypg_result_road_new_"+dzIntensity);
            //获取临时图层
            String url8 = tempLayerUrlMap.get("ypg_result_slope_"+dzIntensity);
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"ypg_result_road_new",url7);
            Layer layer8 = new Layer("TILE",true,"ypg_result_slope",url8);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8);
            layers = Arrays.asList(layer1,layer8);
            if (PlatformObjectUtils.isEmpty(url8)) {//无震后交通情况分布图
                layers = Arrays.asList(layer1);
            }
        }
        //交通遭遇烈度XX度时交通受损情况分布图(Traffic_Damage)
        if ("Traffic_Damage".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-datacenter/rest/maps/jc_lrrl@datacenter";
            String url8 = url + "/map-fxfzypg/rest/maps/sys_road_gaosu@fxfzypg";
            String url9 = url + "/map-fxfzypg/rest/maps/sys_road_guodao@fxfzypg";
            String url10 = url + "/map-fxfzypg/rest/maps/sys_road_shengdao@fxfzypg";
            String url11 = url + "/map-fxfzypg/rest/maps/sys_road_xiandao@fxfzypg";
//            String url12 = url + "/map-fxfzypg/rest/maps/ypg_result_road_new@fxfzypg";
//            String url13 = url + "/map-fxfzypg/rest/maps/ypg_result_slope@fxfzypg";
            //获取临时图层
            String url12 = tempLayerUrlMap.get("ypg_result_road_new_"+dzIntensity);
            //获取临时图层
            String url13 = tempLayerUrlMap.get("ypg_result_slope_"+dzIntensity);
            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"jc_lrrl",url7);
            Layer layer8 = new Layer("TILE",true,"sys_road_gaosu",url8);
            Layer layer9 = new Layer("TILE",true,"sys_road_guodao",url9);
            Layer layer10 = new Layer("TILE",true,"sys_road_shengdao",url10);
            Layer layer11 = new Layer("TILE",true,"sys_road_xiandao",url11);
            Layer layer12 = new Layer("TILE",true,"ypg_result_road_new",url12);
            Layer layer13 = new Layer("TILE",true,"ypg_result_slope",url13);
//            layers = Arrays.asList(layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10,layer11,layer12,layer13);
            layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10,layer11,layer13,layer12);
            if (PlatformObjectUtils.isEmpty(url13)) {//无震后交通情况分布图
                layers = Arrays.asList(layer1,layer7,layer8,layer9,layer10,layer11,layer12);
            }
        }

        //震后辅助决策分析-------------------------------------------------------------------------------------------------
        //基于遥感影像的XX震中影响场范围内房屋抗震能力初判图(RealAnalyse_Kangzhen)
        if ("RealAnalyse_Kangzhen".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
//            String url7 = url + "/map-fxfzypg/rest/maps/data_area@fxfzypg";
            String url8 = url + "/map-datacenter/rest/maps/jc_resp_town@datacenter";
            String url9 = url + "/map-datacenter/rest/maps/jc_resp_village@datacenter";
            String url10 = url + "/map-fxfzypg/rest/maps/sys_airport@fxfzypg";
            String url11 = url + "/map-fxfzypg/rest/maps/sys_road@fxfzypg";
            String url12 = url + "/map-datacenter/rest/maps/jc_lrrl@datacenter";
            String url13 = url + "/map-datacenter/rest/maps/jc_hydl@datacenter";
            //获取临时图层--影响场
            String url14 = tempLayerUrlMap.get("real_seismic_influenceflied");
            String url15 = url + "/map-fxfzypg/rest/maps/sys_kangzhentu@fxfzypg";
            //获取临时图层--震中
            String url16 = tempLayerUrlMap.get("真实地震震中");

            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
//            Layer layer7 = new Layer("TILE",true,"data_area",url7);
            Layer layer8 = new Layer("TILE",true,"jc_resp_town",url8);
            Layer layer9 = new Layer("TILE",true,"jc_resp_village",url9);
            Layer layer10 = new Layer("TILE",true,"sys_airport",url10);
            Layer layer11 = new Layer("TILE",true,"sys_road",url11);
            Layer layer12 = new Layer("TILE",true,"jc_lrrl",url12);
            Layer layer13 = new Layer("TILE",true,"jc_hydl",url13);
            Layer layer14 = new Layer("TILE",true,"real_seismic_influenceflied",url14);
            Layer layer15 = new Layer("TILE",true,"sys_kangzhentu",url15);
            Layer layer16 = new Layer("TILE",true,"真实地震震中",url16);

            layers = Arrays.asList(layer15,layer14,layer13,layer12,layer11,layer10,layer9,layer8,layer1,layer16);
        }
        //建筑物公里格网分布对比图(RealAnalyse_Building)
        if ("RealAnalyse_Building".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/data_pbe_building@fxfzypg";
            //获取临时图层--设定地震烈度影响场
            String url9 = tempLayerUrlMap.get("setting_seismic_influenceflied");
            //获取临时图层--实际地震烈度影响场
            String url10 = tempLayerUrlMap.get("real_seismic_influenceflied");
            //获取临时图层--震中
            String url11 = tempLayerUrlMap.get("real_earthquake_info");
            //获取临时图层--设定地震震中
            String url12 = tempLayerUrlMap.get("设定地震震中");

            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_faultage",url7);
            Layer layer8 = new Layer("TILE",true,"data_pbe_building",url8);
            Layer layer9 = new Layer("TILE",true,"setting_seismic_influenceflied",url9);
            Layer layer10 = new Layer("TILE",true,"real_seismic_influenceflied",url10);
            Layer layer11 = new Layer("TILE",true,"real_earthquake_info",url11);
            Layer layer12 = new Layer("TILE",true,"设定地震震中",url12);

            layers = Arrays.asList(layer10,layer9,layer8,layer7,layer1,layer11,layer12);
        }
        //人口公里格网分布对比图(RealAnalyse_Population)
        if ("RealAnalyse_Population".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/data_pbe_population@fxfzypg";
            //获取临时图层--设定地震烈度影响场
            String url9 = tempLayerUrlMap.get("setting_seismic_influenceflied");
            //获取临时图层--实际地震烈度影响场
            String url10 = tempLayerUrlMap.get("real_seismic_influenceflied");
            //获取临时图层--震中
            String url11 = tempLayerUrlMap.get("real_earthquake_info");
            //获取临时图层--设定地震震中
            String url12 = tempLayerUrlMap.get("设定地震震中");

            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_faultage",url7);
            Layer layer8 = new Layer("TILE",true,"data_pbe_population",url8);
            Layer layer9 = new Layer("TILE",true,"setting_seismic_influenceflied",url9);
            Layer layer10 = new Layer("TILE",true,"real_seismic_influenceflied",url10);
            Layer layer11 = new Layer("TILE",true,"real_earthquake_info",url11);
            Layer layer12 = new Layer("TILE",true,"设定地震震中",url12);

            layers = Arrays.asList(layer10,layer9,layer8,layer7,layer1,layer11,layer12);
        }
        //经济格网分布对比图(RealAnalyse_GDP)
        if ("RealAnalyse_GDP".equals(dictCode)) {
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            /*String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg";
            String url2 = url + "/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg";
            String url3 = url + "/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg";
            String url4 = url + "/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg";
            String url5 = url + "/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg";
            String url6 = url + "/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg";*/
            String url7 = url + "/map-fxfzypg/rest/maps/data_faultage@fxfzypg";
            String url8 = url + "/map-fxfzypg/rest/maps/data_pbe_gdp@fxfzypg";
            //获取临时图层--设定地震烈度影响场
            String url9 = tempLayerUrlMap.get("setting_seismic_influenceflied");
            //获取临时图层--实际地震烈度影响场
            String url10 = tempLayerUrlMap.get("real_seismic_influenceflied");
            //获取临时图层--震中
            String url11 = tempLayerUrlMap.get("real_earthquake_info");
            //获取临时图层--设定地震震中
            String url12 = tempLayerUrlMap.get("设定地震震中");

            Layer layer1 = new Layer("TILE",true,"district_boundary_china",url1);
            /*Layer layer1 = new Layer("TILE",true,"district_boundary_province_text",url1);
            Layer layer2 = new Layer("TILE",true,"district_boundary_city_text",url2);
            Layer layer3 = new Layer("TILE",true,"district_boundary_county_text",url3);
            Layer layer4 = new Layer("TILE",true,"district_boundary_province",url4);
            Layer layer5 = new Layer("TILE",true,"district_boundary_city",url5);
            Layer layer6 = new Layer("TILE",true,"district_boundary_county",url6);*/
            Layer layer7 = new Layer("TILE",true,"data_faultage",url7);
            Layer layer8 = new Layer("TILE",true,"data_pbe_gdp",url8);
            Layer layer9 = new Layer("TILE",true,"setting_seismic_influenceflied",url9);
            Layer layer10 = new Layer("TILE",true,"real_seismic_influenceflied",url10);
            Layer layer11 = new Layer("TILE",true,"real_earthquake_info",url11);
            Layer layer12 = new Layer("TILE",true,"设定地震震中",url12);

            layers = Arrays.asList(layer10,layer9,layer8,layer7,layer1,layer11,layer12);
        }
        if (layers==null){
            String url1 = url + "/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg";
            Layer layer = new Layer("TILE",true,"district_boundary_china",url1);
            layers = Arrays.asList(layer);
        }
        return layers;
    }

    private List<Layerr> getLayerrs(String dictCode,LegendVo legendVo,Map<String,String> tempLayerUrlMap) {
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("supergraphRestTemplateUrl");
        List<Layerr> layerrs =null;
        //人口公里格网分布图
        if ("Population_Grid".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_pbe@fxfzypg.2@@data_pbe_population@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_pbe_population@fxfzypg",strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //经济公里格网分布图
        if ("GDP_Grid".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_pbe@fxfzypg.1@@data_pbe_gdp@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_pbe_gdp@fxfzypg",strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //行政区划分布图
        if ("Administrative_Active_Fault".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("jc_resp_town@datacenter@@jc_resp_town@datacenter");
            Layerr layerr8 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_town@datacenter",strings8);

            List<String> strings9 =Arrays.asList("jc_resp_village@datacenter@@jc_resp_village@datacenter");
            Layerr layerr9 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_village@datacenter",strings9);

            List<String> strings10 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr10 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings10);
//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9,layerr10);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10);
            layerrs = Arrays.asList(layerr10,layerr9,layerr8,layerr1);
        }
        String dzIntensity = legendVo.getDzIntensity();//烈度6-10：建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
        //建筑物综合抗震能力评价图(格网)
        if ("Seismic_Capacity_Grid".equals(dictCode)){
           /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg.2@@seismic_capacity_distribution_2@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/seismic_capacity_distribution_2@fxfzypg",strings7);
            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("seismic_capacity_distribution_2_"+dzIntensity);
            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg@@seismic_capacity_distribution_2@fxfzypg");
            Layerr layerr7 = new Layerr(tempLayerUrl,strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //建筑物综合抗震能力评价图(乡镇)
        if ("Seismic_Capacity_Town".equals(dictCode)){
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg.2@@seismic_capacity_distribution_1@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/seismic_capacity_distribution_1@fxfzypg",strings7);
            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("seismic_capacity_distribution_1_"+dzIntensity);
            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg@@seismic_capacity_distribution_1@fxfzypg");
            Layerr layerr7 = new Layerr(tempLayerUrl,strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //建筑物综合抗震能力评价图(区县)
        if ("Seismic_Capacity_County".equals(dictCode)){
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg.2@@seismic_capacity_distribution_0@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/seismic_capacity_distribution_0@fxfzypg",strings7);
            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("seismic_capacity_distribution_0_"+dzIntensity);
            List<String> strings7 =Arrays.asList("seismic_capacity_distribution@fxfzypg@@seismic_capacity_distribution_0@fxfzypg");
            Layerr layerr7 = new Layerr(tempLayerUrl,strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //学校分布图
        if ("School_Map".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_school@fxfzypg@@data_school@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_school@fxfzypg",strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //地质灾害隐患点分布图
        if ("Geologic_Hazard_Points".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_geological_disasters@fxfzypg@@data_geological_disasters@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_geological_disasters@fxfzypg",strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //历史地震分布图
        if ("Historical_Earthquake".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("jc_strong_catalog@datacenter.2@@jc_strong_catalog@datacenter");
            Layerr layerr7 = new Layerr(url+"/map-datacenter/rest/maps/jc_strong_catalog@datacenter",strings7);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr7);
            layerrs = Arrays.asList(layerr7,layerr1);
        }
        //地震地质构造图
        if ("Historical_Earthquake_Active_Fault".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("jc_strong_catalog@datacenter.2@@jc_strong_catalog@datacenter");
            Layerr layerr7 = new Layerr(url+"/map-datacenter/rest/maps/jc_strong_catalog@datacenter",strings7);

            List<String> strings8 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings8);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8);
            layerrs = Arrays.asList(layerr7,layerr8,layerr1);
        }
        //交通分布图
        if ("Traffic_Map".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("jc_lrrl@datacenter@@jc_lrrl@datacenter");
            Layerr layerr7 = new Layerr(url+"/map-datacenter/rest/maps/jc_lrrl@datacenter",strings7);

            List<String> strings8 =Arrays.asList("sys_road@fxfzypg@@sys_road_gaosu@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_gaosu@fxfzypg",strings8);

            List<String> strings9 =Arrays.asList("sys_road@fxfzypg@@sys_road_guodao@fxfzypg");
            Layerr layerr9 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_guodao@fxfzypg",strings9);

            List<String> strings10 =Arrays.asList("sys_road@fxfzypg@@sys_road_shengdao@fxfzypg");
            Layerr layerr10 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_shengdao@fxfzypg",strings10);

            List<String> strings11 =Arrays.asList("sys_road@fxfzypg@@sys_road_xiandao@fxfzypg");
            Layerr layerr11 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_xiandao@fxfzypg",strings11);

            List<String> strings12 =Arrays.asList("sys_road@fxfzypg@@sys_road_qiaoliang@fxfzypg");
            Layerr layerr12 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_qiaoliang@fxfzypg",strings12);

            List<String> strings13 =Arrays.asList("sys_airport@fxfzypg@@sys_airport@fxfzypg");
            Layerr layerr13 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_airport@fxfzypg",strings13);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9,layerr10,layerr11,layerr12,layerr13);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10,layerr11,layerr12,layerr13);
            layerrs = Arrays.asList(layerr13,layerr12,layerr11,layerr10,layerr9,layerr8,layerr7,layerr1);
        }
        //设置地震点分布图
        if ("Scenario_Earthquake".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg@@district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg@@district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg@@district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg@@district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg@@district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("jc_resp_town@datacenter@@jc_resp_town@datacenter");
            Layerr layerr8 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_town@datacenter",strings8);

            List<String> strings9 =Arrays.asList("jc_resp_village@datacenter@@jc_resp_village@datacenter");
            Layerr layerr9 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_village@datacenter",strings9);

            List<String> strings10 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr10 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings10);

            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("setting_seismic_point");
            List<String> strings11 = Arrays.asList("setting_seismic_point@fxfzypg.2@@setting_seismic_point@fxfzypg");
            Layerr layerr11 = new Layerr(tempLayerUrl,strings11);
            //获取临时图层
            String tempLayerUrl2 = tempLayerUrlMap.get("ypg_preassess_task");
            List<String> strings12 = Arrays.asList("ypg_preassess_task@fxfzypg.1@@ypg_preassess_task@fxfzypg");
            Layerr layerr12 = new Layerr(tempLayerUrl2,strings12);
//            List<String> strings11 = Arrays.asList("setting_seismic_point@fxfzypg@@setting_seismic_point@fxfzypg");
//            Layerr layerr11 = new Layerr(url+"/map-fxfzypg/rest/maps/setting_seismic_point@fxfzypg",strings11);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9,layerr10,layerr11);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10,layerr11);
//            layerrs = Arrays.asList(layerr11,layerr10,layerr9,layerr8,layerr7,layerr1);
            layerrs = Arrays.asList(layerr12,layerr11,layerr10,layerr9,layerr8,layerr1);
        }
        //危化企业,加油站分布图
        if ("Hazardous_Chemicals_Gas".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("sys_riskenterprisedata@fxfzypg@@sys_riskenterprisedata@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_riskenterprisedata@fxfzypg",strings8);

            List<String> strings9 =Arrays.asList("sys_gasstationdata@fxfzypg@@sys_gasstationdata@fxfzypg");
            Layerr layerr9 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_gasstationdata@fxfzypg",strings9);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9);
            layerrs = Arrays.asList(layerr9,layerr8,layerr1);
        }
        //次生危险源分布图
        if ("Chemicals_Gas_Tailings_Pond".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("sys_riskenterprisedata@fxfzypg@@sys_riskenterprisedata@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_riskenterprisedata@fxfzypg",strings8);

            List<String> strings9 =Arrays.asList("sys_gasstationdata@fxfzypg@@sys_gasstationdata@fxfzypg");
            Layerr layerr9 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_gasstationdata@fxfzypg",strings9);

            List<String> strings10 =Arrays.asList("jc_tailings_pond@datacenter@@jc_tailings_pond@datacenter");
            Layerr layerr10 = new Layerr(url+"/map-datacenter/rest/maps/jc_tailings_pond@datacenter",strings10);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9,layerr10);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10);
            layerrs = Arrays.asList(layerr10,layerr9,layerr8,layerr1);
        }
        //水库分布图
        if ("Reservoir_Map".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("data_reservoir@fxfzypg@@data_reservoir@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/data_reservoir@fxfzypg",strings8);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8);
            layerrs = Arrays.asList(layerr8,layerr1);
        }
        //地形图 少一个图例 DEM
        if ("Topography_DEM".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("DEM");
//            List<String> strings7 = new ArrayList<>();
//            Layerr layerr7 = new Layerr(url+"/ugcv5-DEM/rest/maps/DEM",strings7);

//            List<String> strings8 =Arrays.asList("sys_elevation_new@fxfzypg.1@@sys_elevation_new@fxfzypg");
//            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_elevation_new@fxfzypg",strings8);


//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr8,layerr7);
//            layerrs = Arrays.asList(layerr1,layerr8,layerr7);
            layerrs = new ArrayList<>();
            String taskDistrict = legendVo.getPreVo().getTaskDistrict();
            //获取DEM图层名称列表
            List<String> DEMnameList = getDEMlayerNameList(taskDistrict);
            if(DEMnameList.size()>0){//显示1个DEM图层图例
                String DEMname = DEMnameList.get(0);
                String DEMurl = url + "/map-demtif/rest/maps/" + DEMname;
                List<String> strings = new ArrayList<>();
                Layerr DEMlayerr = new Layerr(DEMurl,strings);
                layerrs.add(DEMlayerr);
            }
            layerrs.add(layerr1);
        }
        //调研点分布图(Research_Points)
        if ("Research_Points".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("ypg_sampling_survey_new");
            if (PlatformObjectUtils.isNotEmpty(tempLayerUrl)) {
                List<String> strings8 = Arrays.asList("ypg_sampling_survey_new@fxfzypg.2@@ypg_sampling_survey_new@fxfzypg");
                Layerr layerr8 = new Layerr(tempLayerUrl,strings8);
//                layerrs = Arrays.asList(layerr1,layerr7,layerr8);
                layerrs = Arrays.asList(layerr8,layerr1);
            }else{
//                layerrs = Arrays.asList(layerr1,layerr7);
                layerrs = Arrays.asList(layerr1);
            }

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8);
//            layerrs = Arrays.asList(layerr1,layerr7,layerr8);
        }
        //遭遇烈度XX度地震地质灾害风险分布图(Geologic_Hazard_Risk)
        if ("Geologic_Hazard_Risk".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("ypg_result_road_new@fxfzypg@@ypg_result_road_new@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/ypg_result_road_new@fxfzypg",strings7);
//
//            List<String> strings8 =Arrays.asList("ypg_result_slope@fxfzypg.1@@ypg_result_slope@fxfzypg");
//            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/ypg_result_slope@fxfzypg",strings8);
            //获取临时图层
//            String tempLayerUrl = tempLayerUrlMap.get("ypg_result_road_new_"+dzIntensity);
//            List<String> strings7 = Arrays.asList("ypg_result_road_new@fxfzypg.2@@ypg_result_road_new@fxfzypg");
//            Layerr layerr7 = new Layerr(tempLayerUrl,strings7);
            //获取临时图层
            String tempLayerUrl2 = tempLayerUrlMap.get("ypg_result_slope_"+dzIntensity);
//            List<String> strings8 = Arrays.asList("ypg_result_slope@fxfzypg@@ypg_result_slope@fxfzypg");
            List<String> strings8 = new ArrayList<>();
            Layerr layerr8 = new Layerr(tempLayerUrl2,strings8);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8);
            layerrs = Arrays.asList(layerr1,layerr8);
            if (PlatformObjectUtils.isEmpty(tempLayerUrl2)) {//无震后交通情况分布图
                layerrs = Arrays.asList(layerr1);
            }
        }
        //交通遭遇烈度XX度时交通受损情况分布图(Traffic_Damage)
        if ("Traffic_Damage".equals(dictCode)) {
            /*List<String> strings1 =Arrays.asList("district_boundary_province_text@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province_text@fxfzypg",strings1);

            List<String> strings2 =Arrays.asList("district_boundary_city_text@fxfzypg");
            Layerr layerr2 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city_text@fxfzypg",strings2);

            List<String> strings3 =Arrays.asList("district_boundary_county_text@fxfzypg");
            Layerr layerr3 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county_text@fxfzypg",strings3);

            List<String> strings4 =Arrays.asList("district_boundary_province@fxfzypg");
            Layerr layerr4 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_province@fxfzypg",strings4);

            List<String> strings5 =Arrays.asList("district_boundary_city@fxfzypg");
            Layerr layerr5 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_city@fxfzypg",strings5);

            List<String> strings6 =Arrays.asList("district_boundary_county@fxfzypg");
            Layerr layerr6 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_county@fxfzypg",strings6);*/
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("jc_lrrl@datacenter@@jc_lrrl@datacenter");
            Layerr layerr7 = new Layerr(url+"/map-datacenter/rest/maps/jc_lrrl@datacenter",strings7);

            List<String> strings8 =Arrays.asList("sys_road@fxfzypg@@sys_road_gaosu@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_gaosu@fxfzypg",strings8);

            List<String> strings9 =Arrays.asList("sys_road@fxfzypg@@sys_road_guodao@fxfzypg");
            Layerr layerr9 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_guodao@fxfzypg",strings9);

            List<String> strings10 =Arrays.asList("sys_road@fxfzypg@@sys_road_shengdao@fxfzypg");
            Layerr layerr10 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_shengdao@fxfzypg",strings10);

            List<String> strings11 =Arrays.asList("sys_road@fxfzypg@@sys_road_xiandao@fxfzypg");
            Layerr layerr11 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road_xiandao@fxfzypg",strings11);

//            List<String> strings12 =Arrays.asList("ypg_result_road_new@fxfzypg@@ypg_result_road_new@fxfzypg");
//            Layerr layerr12 = new Layerr(url+"/map-fxfzypg/rest/maps/ypg_result_road_new@fxfzypg",strings12);
//
//            List<String> strings13 =Arrays.asList("ypg_result_slope@fxfzypg.1@@ypg_result_slope@fxfzypg");
//            Layerr layerr13 = new Layerr(url+"/map-fxfzypg/rest/maps/ypg_result_slope@fxfzypg",strings13);

            //获取临时图层
            String tempLayerUrl = tempLayerUrlMap.get("ypg_result_road_new_"+dzIntensity);
            List<String> strings12 = Arrays.asList("ypg_result_road_new@fxfzypg.2@@ypg_result_road_new@fxfzypg");
            Layerr layerr12 = new Layerr(tempLayerUrl,strings12);
            //获取临时图层
            String tempLayerUrl2 = tempLayerUrlMap.get("ypg_result_slope_"+dzIntensity);
//            List<String> strings13 = Arrays.asList("ypg_result_slope@fxfzypg@@ypg_result_slope@fxfzypg");
            List<String> strings13 = new ArrayList<>();
            Layerr layerr13 = new Layerr(tempLayerUrl2,strings13);

//            layerrs = Arrays.asList(layerr1,layerr2,layerr3,layerr4,layerr5,layerr6,layerr7,layerr8,layerr9,layerr10,layerr11,layerr12,layerr13);
            layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10,layerr11,layerr13,layerr12);
            if (PlatformObjectUtils.isEmpty(tempLayerUrl2)) {//无震后交通情况分布图
                layerrs = Arrays.asList(layerr1,layerr7,layerr8,layerr9,layerr10,layerr11,layerr12);
            }
        }
        //基于遥感影像的XX震中影响场范围内房屋抗震能力初判图(RealAnalyse_Kangzhen)
        if ("RealAnalyse_Kangzhen".equals(dictCode)) {
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

//            List<String> strings7 =Arrays.asList("data_area@fxfzypg@@data_area@fxfzypg");
//            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_area@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("jc_resp_town@datacenter@@jc_resp_town@datacenter");
            Layerr layerr8 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_town@datacenter",strings8);

            List<String> strings9 =Arrays.asList("jc_resp_village@datacenter@@jc_resp_village@datacenter");
            Layerr layerr9 = new Layerr(url+"/map-datacenter/rest/maps/jc_resp_village@datacenter",strings9);
            //机场
            List<String> strings10 =Arrays.asList("sys_airport@fxfzypg@@sys_airport@fxfzypg");
            Layerr layerr10 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_airport@fxfzypg",strings10);
            //道路
            List<String> strings11 =Arrays.asList("sys_road@fxfzypg@@sys_road@fxfzypg");
            Layerr layerr11 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_road@fxfzypg",strings11);
            //铁路
            List<String> strings12 =Arrays.asList("jc_lrrl@datacenter@@jc_lrrl@datacenter");
            Layerr layerr12 = new Layerr(url+"/map-datacenter/rest/maps/jc_lrrl@datacenter",strings12);
            //水系线
            List<String> strings13 =Arrays.asList("jc_hydl@datacenter@@jc_hydl@datacenter");
            Layerr layerr13 = new Layerr(url+"/map-datacenter/rest/maps/jc_hydl@datacenter",strings13);
            //获取临时图层--影响场
            String tempLayerUrl = tempLayerUrlMap.get("real_seismic_influenceflied");
            List<String> strings14 = Arrays.asList("real_seismic_influenceflied@fxfzypg@@real_seismic_influenceflied@fxfzypg");
            Layerr layerr14 = new Layerr(tempLayerUrl,strings14);
            //房屋抗震能力初步评估
            List<String> strings15 =Arrays.asList("sys_kangzhentu@fxfzypg@@sys_kangzhentu@fxfzypg");
            Layerr layerr15 = new Layerr(url+"/map-fxfzypg/rest/maps/sys_kangzhentu@fxfzypg",strings15);
            //获取临时图层--震中
            String tempLayerUrl2 = tempLayerUrlMap.get("真实地震震中");
            List<String> strings16 = Arrays.asList("real_earthquake_info@fxfzypg.1@@真实地震震中");
            Layerr layerr16 = new Layerr(tempLayerUrl2,strings16);

            layerrs = Arrays.asList(layerr15,layerr14,layerr13,layerr12,layerr11,layerr10,layerr9,layerr8,layerr1,layerr16);
        }
        //建筑物公里格网分布对比图(RealAnalyse_Building)
        if ("RealAnalyse_Building".equals(dictCode)) {
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("data_pbe@fxfzypg.1@@data_pbe_building@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/data_pbe_building@fxfzypg",strings8);

            //获取临时图层--设定地震烈度影响场
            String tempLayerUrl = tempLayerUrlMap.get("setting_seismic_influenceflied");
            List<String> strings9 = Arrays.asList("setting_seismic_influenceflied@fxfzypg@@setting_seismic_influenceflied@fxfzypg");
            Layerr layerr9 = new Layerr(tempLayerUrl,strings9);
            //获取临时图层--实际地震烈度影响场
            String tempLayerUrl2 = tempLayerUrlMap.get("real_seismic_influenceflied");
            List<String> strings10 = Arrays.asList("real_seismic_influenceflied@fxfzypg@@real_seismic_influenceflied@fxfzypg");
            Layerr layerr10 = new Layerr(tempLayerUrl2,strings10);
            //获取临时图层--震中
            String tempLayerUrl3 = tempLayerUrlMap.get("real_earthquake_info");
            List<String> strings11 = Arrays.asList("real_earthquake_info@fxfzypg.1@@real_earthquake_info@fxfzypg");
            Layerr layerr11 = new Layerr(tempLayerUrl3,strings11);

            layerrs = Arrays.asList(layerr10,layerr9,layerr8,layerr7,layerr1,layerr11);
        }
        //人口公里格网分布对比图(RealAnalyse_Population)
        if ("RealAnalyse_Population".equals(dictCode)) {
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("data_pbe@fxfzypg.2@@data_pbe_population@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/data_pbe_population@fxfzypg",strings8);

            //获取临时图层--设定地震烈度影响场
            String tempLayerUrl = tempLayerUrlMap.get("setting_seismic_influenceflied");
            List<String> strings9 = Arrays.asList("setting_seismic_influenceflied@fxfzypg@@setting_seismic_influenceflied@fxfzypg");
            Layerr layerr9 = new Layerr(tempLayerUrl,strings9);
            //获取临时图层--实际地震烈度影响场
            String tempLayerUrl2 = tempLayerUrlMap.get("real_seismic_influenceflied");
            List<String> strings10 = Arrays.asList("real_seismic_influenceflied@fxfzypg@@real_seismic_influenceflied@fxfzypg");
            Layerr layerr10 = new Layerr(tempLayerUrl2,strings10);
            //获取临时图层--震中
            String tempLayerUrl3 = tempLayerUrlMap.get("real_earthquake_info");
            List<String> strings11 = Arrays.asList("real_earthquake_info@fxfzypg.1@@real_earthquake_info@fxfzypg");
            Layerr layerr11 = new Layerr(tempLayerUrl3,strings11);

            layerrs = Arrays.asList(layerr10,layerr9,layerr8,layerr7,layerr1,layerr11);
        }
        //经济格网分布对比图(RealAnalyse_GDP)
        if ("RealAnalyse_GDP".equals(dictCode)) {
            List<String> strings1 = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr1 = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings1);

            List<String> strings7 =Arrays.asList("data_faultage@fxfzypg@@data_faultage@fxfzypg");
            Layerr layerr7 = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings7);

            List<String> strings8 =Arrays.asList("data_pbe@fxfzypg.1@@data_pbe_gdp@fxfzypg");
            Layerr layerr8 = new Layerr(url+"/map-fxfzypg/rest/maps/data_pbe_gdp@fxfzypg",strings8);

            //获取临时图层--设定地震烈度影响场
            String tempLayerUrl = tempLayerUrlMap.get("setting_seismic_influenceflied");
            List<String> strings9 = Arrays.asList("setting_seismic_influenceflied@fxfzypg@@setting_seismic_influenceflied@fxfzypg");
            Layerr layerr9 = new Layerr(tempLayerUrl,strings9);
            //获取临时图层--实际地震烈度影响场
            String tempLayerUrl2 = tempLayerUrlMap.get("real_seismic_influenceflied");
            List<String> strings10 = Arrays.asList("real_seismic_influenceflied@fxfzypg@@real_seismic_influenceflied@fxfzypg");
            Layerr layerr10 = new Layerr(tempLayerUrl2,strings10);
            //获取临时图层--震中
            String tempLayerUrl3 = tempLayerUrlMap.get("real_earthquake_info");
            List<String> strings11 = Arrays.asList("real_earthquake_info@fxfzypg.1@@real_earthquake_info@fxfzypg");
            Layerr layerr11 = new Layerr(tempLayerUrl3,strings11);

            layerrs = Arrays.asList(layerr10,layerr9,layerr8,layerr7,layerr1,layerr11);
        }

        if (layerrs==null){
            List<String> strings = Arrays.asList("district_boundary_province@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_province_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_city_text@fxfzypg@@district_boundary_china@fxfzypg","district_boundary_county_text@fxfzypg@@district_boundary_china@fxfzypg");
            Layerr layerr = new Layerr(url+"/map-fxfzypg/rest/maps/district_boundary_china@fxfzypg",strings);
//            List<String> strings =Arrays.asList("data_faultage@fxfzypg");
//            Layerr layerr = new Layerr(url+"/map-fxfzypg/rest/maps/data_faultage@fxfzypg",strings);
            layerrs = Arrays.asList(layerr);
        }
        return layerrs;
    }

    private MapManagementEntity getEntity(String imageId, LegendVo legendVo, MapTemplate mapTemplate) {
        MapManagementEntity mapManagementEntity = new MapManagementEntity();
        mapManagementEntity.setMapId(UUIDGenerator.getUUID());
        mapManagementEntity.setTaskId(legendVo.getPreVo().getId());
        mapManagementEntity.setTaskName(legendVo.getPreVo().getTaskCodeAndTaskName());
        mapManagementEntity.setTaskDistrict(legendVo.getPreVo().getTaskDistrict());
        mapManagementEntity.setAttachId(imageId);
        //名称 暂时搞成类型
        String dictType = mapTemplate.getDictType();
        mapManagementEntity.setMapName(dictType);
        String dictCode = mapTemplate.getDictCode();
        String order = getByCode(dictCode);
        mapManagementEntity.setMapLabel(order);
        mapManagementEntity.setMapDescription(dictType);

        String classify = "0";
        if ("Seismic_Capacity_Grid".equals(dictCode)||"Seismic_Capacity_Town".equals(dictCode)||"Seismic_Capacity_County".equals(dictCode)||"Scenario_Earthquake".equals(dictCode)||"Geologic_Hazard_Risk".equals(dictCode)||"Traffic_Damage".equals(dictCode)){
            classify = "1";
        }
        mapManagementEntity.setMapClassify(classify);
        mapManagementEntity.setDelFlag(YNEnum.N.toString());
        mapManagementEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
        mapManagementEntity.setUploadTime(PlatformDateUtils.getCurrentTimestamp());
        String userId = PlatformSessionUtils.getUserId();
        mapManagementEntity.setCreateUser(userId);
        if (PlatformObjectUtils.isNotEmpty(userId)) {
            String userJson = sUserService.getSUser(PlatformSessionUtils.getUserId());
            SUser sUser = CreateGson.createGson().fromJson(userJson, SUser.class);
            if (sUser != null) {
                mapManagementEntity.setUploader(sUser.getUserName());
            }
        }
        return mapManagementEntity;
    }

    private String getByCode(String dictCode) {
        if ("Administrative_Active_Fault".equals(dictCode)) return "0";
        if ("Population_Grid".equals(dictCode)) return "1";
        if ("GDP_Grid".equals(dictCode)) return "2";
        if ("Topography_DEM".equals(dictCode)) return "3";
        if ("Historical_Earthquake_Active_Fault".equals(dictCode)) return "4";
        if ("Traffic_Map".equals(dictCode)) return "5";
        if ("Scenario_Earthquake".equals(dictCode)) return "6";
        if ("Geologic_Hazard_Points".equals(dictCode)) return "7";
        if ("Chemicals_Gas_Tailings_Pond".equals(dictCode)) return "8";
        if ("Seismic_Capacity_Grid".equals(dictCode)) return "9";
        if ("Seismic_Capacity_Town".equals(dictCode)) return "10";
        if ("Seismic_Capacity_County".equals(dictCode)) return "11";
        if ("School_Map".equals(dictCode)) return "12";
        if ("Historical_Earthquake".equals(dictCode)) return "13";
        if ("Research_Points".equals(dictCode)) return "14";
        if ("Geologic_Hazard_Risk".equals(dictCode)) return "15";
        if ("Traffic_Damage".equals(dictCode)) return "16";
        if ("Hazardous_Chemicals_Gas".equals(dictCode)) return "17";
        if ("Reservoir_Map".equals(dictCode)) return "18";

        return "19";
    }

    //获取临时图层url
    private String getSqlTempLayer(String layerUrl, String sqlText,boolean showLabelBool,String dataType) {
        String resultUrl = layerUrl;
        if (PlatformObjectUtils.isNotEmpty(sqlText)) {
            JSONArray jsonArray = getLayersRJson(layerUrl);
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONArray layers = jsonArray.getJSONObject(i).getJSONObject("subLayers").getJSONArray("layers");
                for(int j=0;j<layers.size();j++){
                    JSONObject layer = layers.getJSONObject(j);
                    //获取图层过滤条件
                    String displayFilter = layer.getString("displayFilter");
                    if (PlatformObjectUtils.isNotEmpty(displayFilter)) {
                        displayFilter = "(" + displayFilter + ") AND " + sqlText;
                    }else{
                        displayFilter = sqlText;
                    }
                    layer.put("displayFilter",displayFilter);
                    if(showLabelBool==false && layer.getString("ugcLayerType")=="THEME"){
                        if(layer.getJSONObject("theme").getString("type")=="LABEL"){//文字标签子图层
                            layer.put("visible",showLabelBool);
                        }
                    }
                    //修改专题图图例图层名称
                    if(dataType.startsWith("ypg_result_slope_")){
                        layer.put("caption","震后交通情况等级");
                    }
                }
            }
            String jsonStr = JSON.toJSONString(jsonArray);
            JSONObject resultObj = postTempLayersSet(layerUrl,jsonStr);
            String newResourceID = resultObj.getString("newResourceID");
            String newResourceLocation = resultObj.getString("newResourceLocation");
            if (PlatformObjectUtils.isNotEmpty(newResourceLocation)) {
                resultUrl = newResourceLocation.replace(".rjson","");
            }
        }
        return resultUrl;
    }

    private JSONArray getLayersRJson(String layerUrl) {
        try {
            String dataUrl = layerUrl + "/layers.rjson";
            try {
                dataUrl = URLDecoder.decode(dataUrl, "utf-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
                return null;
            }
            dataUrl = dataUrl.replaceAll("%3A", ":").replaceAll("%2F", "/").replaceAll("\\+", "%20");
            //System.out.println(dataUrl);

            HttpHeaders headers = new HttpHeaders();
            headers.set("Content-Type", "application/json; charset=UTF-8");

            HttpEntity<JSONObject> entity = new HttpEntity<>(new JSONObject(), headers);
            ResponseEntity<String> exchange = restTemplate.exchange(dataUrl, HttpMethod.GET, entity, String.class);
            JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(exchange));
            JSONArray body = JSON.parseArray(jsonObject.getString("body"));
            if (body == null) {
                return null;
            }
            return body;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    private JSONObject postTempLayersSet(String layerUrl, String jsonStr){
        JSONObject result = new JSONObject();
        String dataUrl = layerUrl + "/tempLayersSet.rjson";
        try {
            dataUrl = URLDecoder.decode(dataUrl, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
        dataUrl = dataUrl.replaceAll("%3A", ":").replaceAll("%2F", "/").replaceAll("\\+", "%20");

        HttpHeaders headers = new HttpHeaders();
        headers.set("Content-Type", "application/json; charset=UTF-8");

        HttpEntity<String> entity = new HttpEntity<>(jsonStr, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(dataUrl, HttpMethod.POST, entity, String.class);
        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(exchange));
        JSONObject body = JSON.parseObject(jsonObject.getString("body"));
        if (body == null) {
            return null;
        }
        result = body;

        return result;
    }

    //根据dictCode、任务ID获取临时图层URL的Map
    public Map<String,String> getTempLayerUrlMapByDictCode(String dictCode,LegendVo legendVo){
        Map<String,String> tempLayerUrlMap = new HashMap<>();
        String dzIntensity = legendVo.getDzIntensity();//烈度6-10：建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
        if ("Seismic_Capacity_County".equals(dictCode)) {//建筑物综合抗震能力评价图(区县)
            String tempLayerUrl = getTempLayerUrlByDataType("seismic_capacity_distribution_0_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("seismic_capacity_distribution_0_"+dzIntensity,tempLayerUrl);
        }else if ("Seismic_Capacity_Town".equals(dictCode)) {//建筑物综合抗震能力评价图(乡镇)
            String tempLayerUrl = getTempLayerUrlByDataType("seismic_capacity_distribution_1_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("seismic_capacity_distribution_1_"+dzIntensity,tempLayerUrl);
        }else if ("Seismic_Capacity_Grid".equals(dictCode)) {//建筑物综合抗震能力评价图(格网)
            String tempLayerUrl = getTempLayerUrlByDataType("seismic_capacity_distribution_2_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("seismic_capacity_distribution_2_"+dzIntensity,tempLayerUrl);
        }else if ("Scenario_Earthquake".equals(dictCode)) {//设置地震点分布图
            String tempLayerUrl = getTempLayerUrlByDataType("setting_seismic_point",legendVo);
            tempLayerUrlMap.put("setting_seismic_point",tempLayerUrl);
            String tempLayerUrl2 = getTempLayerUrlByDataType("ypg_preassess_task",legendVo);
            tempLayerUrlMap.put("ypg_preassess_task",tempLayerUrl2);
        }else if ("Research_Points".equals(dictCode)) {//调研点分布图
            String tempLayerUrl = getTempLayerUrlByDataType("ypg_sampling_survey_new",legendVo);
            tempLayerUrlMap.put("ypg_sampling_survey_new",tempLayerUrl);
        }else if ("Geologic_Hazard_Risk".equals(dictCode)) {//遭遇烈度XX度地震地质灾害风险分布图
            String tempLayerUrl = getTempLayerUrlByDataType("ypg_result_road_new_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("ypg_result_road_new_"+dzIntensity,tempLayerUrl);
            String tempLayerUrl2 = getTempLayerUrlByDataType("ypg_result_slope_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("ypg_result_slope_"+dzIntensity,tempLayerUrl2);
        }else if ("Traffic_Damage".equals(dictCode)) {//交通遭遇烈度XX度时交通受损情况分布图
            String tempLayerUrl = getTempLayerUrlByDataType("ypg_result_road_new_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("ypg_result_road_new_"+dzIntensity,tempLayerUrl);
            String tempLayerUrl2 = getTempLayerUrlByDataType("ypg_result_slope_"+dzIntensity,legendVo);
            tempLayerUrlMap.put("ypg_result_slope_"+dzIntensity,tempLayerUrl2);
        }else if (dictCode.contains("RealAnalyse_")) {//震后辅助决策分析结果打印出图
            //基于遥感影像的XX震中影响场范围内房屋抗震能力初判图(RealAnalyse_Kangzhen)
            //建筑物公里格网分布对比图(RealAnalyse_Building)
            //人口公里格网分布对比图(RealAnalyse_Population)
            //经济格网分布对比图(RealAnalyse_GDP)
            //获取临时图层--实际地震烈度影响场
            String tempLayerUrl = tempLayerUrlMap.get("real_seismic_influenceflied");
            if(PlatformObjectUtils.isEmpty(tempLayerUrl)){
                tempLayerUrl = getTempLayerUrlByDataType("real_seismic_influenceflied",legendVo);
                tempLayerUrlMap.put("real_seismic_influenceflied",tempLayerUrl);
            }
            //获取临时图层--震中
            String tempLayerUrl2 = tempLayerUrlMap.get("real_earthquake_info");
            if(PlatformObjectUtils.isEmpty(tempLayerUrl2)){
                tempLayerUrl2 = getTempLayerUrlByDataType("real_earthquake_info",legendVo);
                tempLayerUrlMap.put("real_earthquake_info",tempLayerUrl2);
            }
            //获取临时图层--设定地震烈度影响场
            String tempLayerUrl3 = tempLayerUrlMap.get("setting_seismic_influenceflied");
            if(PlatformObjectUtils.isEmpty(tempLayerUrl3)){
                tempLayerUrl3 = getTempLayerUrlByDataType("setting_seismic_influenceflied",legendVo);
                tempLayerUrlMap.put("setting_seismic_influenceflied",tempLayerUrl3);
            }
            //获取临时图层--设定地震震中
            String tempLayerUrl4 = tempLayerUrlMap.get("设定地震震中");
            if(PlatformObjectUtils.isEmpty(tempLayerUrl4)){
                tempLayerUrl4 = getTempLayerUrlByDataType("设定地震震中",legendVo);
                tempLayerUrlMap.put("设定地震震中",tempLayerUrl4);
            }
            //获取临时图层--真实地震震中
            String tempLayerUrl5 = tempLayerUrlMap.get("真实地震震中");
            if(PlatformObjectUtils.isEmpty(tempLayerUrl5)){
                tempLayerUrl5 = getTempLayerUrlByDataType("真实地震震中",legendVo);
                tempLayerUrlMap.put("真实地震震中",tempLayerUrl5);
            }
        }
        return tempLayerUrlMap;
    }

    //根据数据类型、任务ID获取临时图层URL
    public String getTempLayerUrlByDataType(String dataType,LegendVo legendVo){
        String tempLayerUrl = "";
        String layerUrl = "";
        String sqlText = "";
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("supergraphRestTemplateUrl");
        String cataId = legendVo.getCataId();
        if (!PlatformObjectUtils.isEmpty(cataId)) {//中国地震台网系统的真实地震信息的ID
            if(dataType.equals("real_seismic_influenceflied")){//实际地震影响场
                layerUrl = url + "/map-fxfzypg/rest/maps/real_seismic_influenceflied@fxfzypg";
                sqlText = "cata_id='"+cataId+"'";
            }else if(dataType.equals("real_earthquake_info")){//实际地震震中
                layerUrl = url + "/map-fxfzypg/rest/maps/real_earthquake_info@fxfzypg";
                sqlText = "cata_id='"+cataId+"'";
            }else if(dataType.equals("真实地震震中")){//真实地震震中
                layerUrl = url + "/map-fxfzypg/rest/maps/真实地震震中";
                sqlText = "cata_id='"+cataId+"'";
            }
            String ssId = legendVo.getSsId();//设定地震震中ssId
            String sourceEarthquakeId = legendVo.getSourceEarthquakeId();//设定地震详情ID
            PreAssessVo preAssessVo = legendVo.getPreAssessVo();//预评估任务
            String taskId = preAssessVo.getId();
            BigDecimal earthquakeLevel = legendVo.getEarthquakeLevel();//设定地震震级
            if (!PlatformObjectUtils.isEmpty(cataId)) {
                if(dataType.equals("setting_seismic_influenceflied")){//设定地震影响场
                    layerUrl = url + "/map-fxfzypg/rest/maps/setting_seismic_influenceflied@fxfzypg";
                    sqlText = "task_id='"+taskId+"' and source_earthquake_id='"+sourceEarthquakeId+"' and earthquake_level="+earthquakeLevel;
                }else if(dataType.equals("设定地震震中")){//设定地震震中
                    layerUrl = url + "/map-fxfzypg/rest/maps/设定地震震中";
                    sqlText = "ss_id='"+ssId+"'";
                }
            }
        }else{//一键出图
            String taskId = legendVo.getPreVo().getId();//任务ID
            String taskNum = legendVo.getPreVo().getTaskNum();//任务编号
            String reportType = legendVo.getReportType();//任务类型
            PreAssessVo preAssessVo = legendVo.getPreAssessVo();//预评估任务
            FieldSurveyVo fieldSurveyVo = legendVo.getFieldSurveyVo();//现场调查任务
            List<String> taskIdList = legendVo.getTaskIdList();//子任务ID列表
            String taskIdStr = "";
            if(taskIdList!=null && taskIdList.size()>0){
                for(int i=0;i<taskIdList.size();i++){
                    taskIdStr += " or task_id='" + taskIdList.get(i) + "'";
                }
            }
            String dzIntensity = legendVo.getDzIntensity();//烈度6-10：建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
            if(dataType.equals("seismic_capacity_distribution_0_"+dzIntensity)){//建筑物综合抗震能力评价图(区县)
                layerUrl = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_0@fxfzypg";
                sqlText = "data_source='0' and dz_intensity='"+dzIntensity+"' and (task_id='"+taskId+"'"+taskIdStr+")";
            }else if(dataType.equals("seismic_capacity_distribution_1_"+dzIntensity)){//建筑物综合抗震能力评价图(乡镇)
                layerUrl = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_1@fxfzypg";
                sqlText = "data_source='1' and dz_intensity='"+dzIntensity+"' and (task_id='"+taskId+"'"+taskIdStr+")";
            }else if(dataType.equals("seismic_capacity_distribution_2_"+dzIntensity)){//建筑物综合抗震能力评价图(格网)
                layerUrl = url + "/map-fxfzypg/rest/maps/seismic_capacity_distribution_2@fxfzypg";
                sqlText = "data_source='2' and dz_intensity='"+dzIntensity+"' and (task_id='"+taskId+"'"+taskIdStr+")";
            }else if(dataType.equals("setting_seismic_point")){//设定地震点
                layerUrl = url + "/map-fxfzypg/rest/maps/setting_seismic_point@fxfzypg";
                sqlText = "is_delete='0' and (task_id='"+taskId+"'"+taskIdStr+")";
            }else if(dataType.equals("ypg_preassess_task")){//预评估任务区域
                layerUrl = url + "/map-fxfzypg/rest/maps/ypg_preassess_task@fxfzypg";
                sqlText = "id='"+taskId+"'";
            }else if(dataType.equals("ypg_sampling_survey_new")){//调研点
                layerUrl = url + "/map-fxfzypg/rest/maps/ypg_sampling_survey_new@fxfzypg";
                //0 是预评估任务  1是现场调查任务
                if ("0".equals(reportType) && preAssessVo!=null) {
                    String idStr = "";
                    //查询子任务关联抽样调查点
                    String sql = "select sampling_survey_point_id from ypg_preassess_task where parent_task='"+taskNum+"' and del_flag='0'";
                    List<String> list = jdbcTemplate.queryForList(sql, String.class);
                    if(list!=null && list.size()>0){
                        for(String samplingSurveyPointId : list){
                            if(PlatformObjectUtils.isNotEmpty(samplingSurveyPointId)){
                                String[] idArr = samplingSurveyPointId.split(",");
                                for(int i=0;i<idArr.length;i++){
                                    String id = idArr[i];
                                    if (!PlatformObjectUtils.isEmpty(id)) {
                                        if (!PlatformObjectUtils.isEmpty(idStr)) {
                                            idStr += ",";
                                        }
                                        idStr += "'"+id+"'";
                                    }
                                }
                            }
                        }
                    }
                    //无子任务，任务本身关联抽样调查点
                    String samplingSurveyPointId = preAssessVo.getSamplingSurveyPointId();
                    if (PlatformObjectUtils.isEmpty(idStr) && PlatformObjectUtils.isNotEmpty(samplingSurveyPointId)) {
                        String[] idArr = samplingSurveyPointId.split(",");
                        for(int i=0;i<idArr.length;i++){
                            String id = idArr[i];
                            if (!PlatformObjectUtils.isEmpty(id)) {
                                if (!PlatformObjectUtils.isEmpty(idStr)) {
                                    idStr += ",";
                                }
                                idStr += "'"+id+"'";
                            }
                        }
                    }
                    sqlText = "del_flag='0' and id in ("+idStr+")";
                }else{
                    sqlText = "task_code='"+taskNum+"' and del_flag='0'";
                }
            }else if(dataType.equals("ypg_result_road_new_"+dzIntensity)){//影响道路
                layerUrl = url + "/map-fxfzypg/rest/maps/ypg_result_road_new@fxfzypg";
                sqlText = "task_id='"+taskId+"'"+taskIdStr+" and dz_intensity='"+dzIntensity+"'";
            }else if(dataType.equals("ypg_result_slope_"+dzIntensity)){//震后交通情况等级
                /*layerUrl = url + "/map-fxfzypg/rest/maps/ypg_result_slope@fxfzypg";
                sqlText = "task_id='"+taskId+"'"+taskIdStr;*/
                //获取震后交通情况分布图的分级矢量化图层名
                String layerName = getYpgResultSlopeLayerName(taskId,dzIntensity);
                if(layerName!=null){
//                    tempLayerUrl = url + "/map-ypgTifCount/rest/maps/" + layerName;
//                    System.out.println(dataType+"矢量图层："+tempLayerUrl);
                    layerUrl = url + "/map-ypgTifCount/rest/maps/" + layerName;
                    sqlText = "1=1";
                }
            }
        }
        if (PlatformObjectUtils.isNotEmpty(layerUrl) && PlatformObjectUtils.isNotEmpty(sqlText)) {
            //获取临时图层
            tempLayerUrl = getSqlTempLayer(layerUrl, sqlText,true,dataType);
            System.out.println(dataType+"临时图层："+tempLayerUrl);
        }
        return tempLayerUrl;
    }

    //获取DEM图层名称列表
    public List<String> getDEMlayerNameList(String taskDistrict){
        List<String> nameList = new ArrayList<>();
        //DEM图层名
        String tempsql = "";
        String[] district = taskDistrict.split("、");
        List<String> provinceList = new ArrayList<>();
        for(int i=0;i<district.length;i++){
            String[] strArr = district[i].split("-");
            if(strArr.length>0){
                //正常
            }else{
                continue;
            }
            if (PlatformObjectUtils.isNotEmpty(tempsql)) {
                tempsql += " or ";
            }
            String province = strArr[0];
            if(!provinceList.contains(province)){
                provinceList.add(province);
            }
            tempsql += "(province='"+province+"'";
            if(province.equals("北京市") || province.equals("天津市") || province.equals("上海市") || province.equals("重庆市")){
                tempsql += " and city='"+province+"'";
                if(strArr.length>1){
                    tempsql += " and area='"+strArr[1]+"'";
                }else{
                    tempsql += " and area=''";
                }
            }else{
                if(strArr.length>1){
                    tempsql += " and city='"+strArr[1]+"'";
                }else{
                    tempsql += " and city=''";
                }
                if(strArr.length>2){
                    tempsql += " and area='"+strArr[2]+"'";
                }else{
                    tempsql += " and area=''";
                }
            }
            tempsql += ")";
        }
        if(provinceList.size()>0){
            for(int i=0;i<provinceList.size();i++){
                String province = provinceList.get(i);
                if (PlatformObjectUtils.isNotEmpty(tempsql)) {
                    tempsql += " or ";
                }
                tempsql += "(province='"+province+"' and city='' and area='')";
            }
        }
        //查询DEM高程文件图层名称
        String sql = "SELECT affiliated_file_name FROM qh_map_files where type='地形地貌（高程）_' and is_delete='0' and ("+tempsql+")";
        List<String> list = jdbcTemplate.queryForList(sql, String.class);
        for(int i=0;i<list.size();i++){
            String name = list.get(i);
            nameList.add(name);
        }

        return nameList;
    }

    //获取图件标题
    public String getTitleByDictCodeTask(LegendVo legendVo,MapTemplate mapTemplate){
        String title = mapTemplate.getDictType();//标题
        String dictCode = mapTemplate.getDictCode();//出图类型字典code
        if ("Geologic_Hazard_Risk".equals(dictCode) || "Traffic_Damage".equals(dictCode)){
            String intensity = legendVo.getDzIntensity();
            if(intensity.equals("6")){
                intensity = "Ⅵ";
            }else if(intensity.equals("7")){
                intensity = "Ⅶ";
            }else if(intensity.equals("8")){
                intensity = "Ⅷ";
            }else if(intensity.equals("9")){
                intensity = "Ⅸ";
            }else if(intensity.equals("10")){
                intensity = "Ⅹ";
            }else if(intensity.equals("11")){
                intensity = "Ⅺ";
            }
            if ("Geologic_Hazard_Risk".equals(dictCode)) {//遭遇烈度XX度地震地质灾害风险分布图
                title = "遭遇烈度"+intensity+"度地震地质灾害风险分布图";
            }else if ("Traffic_Damage".equals(dictCode)) {//交通遭遇烈度XX度时交通受损情况分布图
                title = "交通遭遇烈度"+intensity+"度时交通受损情况分布图";
            }
        }else if("RealAnalyse_Kangzhen".equals(dictCode)){//基于遥感影像的XX震中影响场范围内房屋抗震能力初判图(RealAnalyse_Kangzhen)
            //真实地震信息
            RealEarthquakeEntity realEarthquakeEntity = legendVo.getRealEarthquakeEntity();
            if(realEarthquakeEntity!=null){
                title = "基于遥感影像的"+realEarthquakeEntity.getProvince()+realEarthquakeEntity.getCity()+realEarthquakeEntity.getCounty()+
                        realEarthquakeEntity.getM()+"级地震震中影响场范围内房屋抗震能力初判图";
            }
        }else if ("Seismic_Capacity_Grid".equals(dictCode)||"Seismic_Capacity_Town".equals(dictCode)||"Seismic_Capacity_County".equals(dictCode)) {
            //烈度6-10：建筑物综合抗震能力评价图（区县、乡镇、格网）每种类型按不同烈度保存多张图
            String dzIntensity = legendVo.getDzIntensity();
            String intensity = "Ⅵ";
            if(dzIntensity.equals("6")){
                intensity = "Ⅵ";
            }else if(dzIntensity.equals("7")){
                intensity = "Ⅶ";
            }else if(dzIntensity.equals("8")){
                intensity = "Ⅷ";
            }else if(dzIntensity.equals("9")){
                intensity = "Ⅸ";
            }else if(dzIntensity.equals("10")){
                intensity = "Ⅹ";
            }else if(dzIntensity.equals("11")){
                intensity = "Ⅺ";
            }
            title = "烈度" + intensity + "度" + title;
        }

        return title;
    }

    //获取震后交通情况分布图的分级矢量化图层名
    public String getYpgResultSlopeLayerName(String taskId,String dzIntensity) {
        String layerName = null;
        try{
            String sql = "select file_path from ypg_result_slope_new where task_id = '"+taskId+"' and dz_intensity = '"+dzIntensity+
                    "' and extends1='分级矢量化' limit 1";
            layerName = jdbcTemplate.queryForObject(sql, String.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return layerName;
    }
}
